DefaultRenderer RenderObject Method | Apache log4net™ SDK Documentation

Render the object obj to a string

Namespace: log4net.ObjectRenderer
Assembly: log4net (in log4net.dll) Version: 2.0.8.0-.NET 4.0
Syntax

C#
VB
C++
F#
Copy

    public void RenderObject(
    	RendererMap rendererMap,
    	Object obj,
    	TextWriter writer
    )

    Public Sub RenderObject (
    	rendererMap As RendererMap,
    	obj As Object,
    	writer As TextWriter
    )

    public:
    virtual void RenderObject(
    	RendererMap^ rendererMap,
    	Object^ obj,
    	TextWriter^ writer
    ) sealed

    abstract RenderObject :
            rendererMap : RendererMap *
            obj : Object *
            writer : TextWriter -> unit
    override RenderObject :
            rendererMap : RendererMap *
            obj : Object *
            writer : TextWriter -> unit

#### Parameters

rendererMap
  Type: log4net.ObjectRenderer
  RendererMap
  The map used to lookup renderers
obj
  Type: System
  Object
  The object to render
writer
  Type: System.IO
  TextWriter
  The writer to render to

#### Implements

IObjectRenderer
RenderObject(RendererMap, Object, TextWriter)
Remarks

Render the object obj to a string.

The rendererMap parameter is provided to lookup and render other objects. This is very useful where obj contains nested objects of unknown type. The FindAndRender(object) method can be used to render these objects.

The default renderer supports rendering objects to strings as follows:

Value | Rendered String
--- | ---
null | "(null)"
Array | For a one dimensional array this is the array type name, an open brace, followed by a comma separated list of the elements (using the appropriate renderer), followed by a close brace. For example: int[] {1, 2, 3}. If the array is not one dimensional the Array.ToString() is returned.
IEnumerable, ICollection & IEnumerator | Rendered as an open brace, followed by a comma separated list of the elements (using the appropriate renderer), followed by a close brace. For example: {a, b, c}. All collection classes that implement ICollection its subclasses, or generic equivalents all implement the IEnumerable interface.
DictionaryEntry | Rendered as the key, an equals sign ('='), and the value (using the appropriate renderer). For example: key=value.
other | Object.ToString()

See Also

#### Reference

DefaultRenderer Class
log4net.ObjectRenderer Namespace