XmlWriterTraceListener Constructor (TextWriter, String)


Initializes a new instance of the XmlWriterTraceListener class with the specified name, using the specified writer as the recipient of the debugging and tracing output.

Namespace:   System.Diagnostics
Assembly:  System (in System.dll)

public XmlWriterTraceListener(
	TextWriter writer,
	string name


Type: System.IO.TextWriter

A TextWriter that receives the output from the trace listener.

Type: System.String

The name of the new instance.

Exception Condition

writer is null.

This constructor initializes the Name property to the name parameter value or to an empty string ("") if the name parameter is null. The name can be used as an index into the Trace.Listeners collection to programmatically change the properties for the listener. For example, the following code sets the TraceOutputOptions property for an instance of XmlWriterTraceListener whose Name property is "xmlListener".

((XmlWriterTraceListener)Trace.Listeners["xmlListener"]).TraceOutputOptions = 


for the ability to call unmanaged code. Associated enumeration: UnmanagedCode.

.NET Framework
Available since 2.0
Return to top