XmlWriterTraceListener Constructor (Stream, String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

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

public XmlWriterTraceListener(
	Stream stream,
	string name


Type: System.IO.Stream

A Stream that represents the stream the trace listener writes to.

Type: System.String

The name of the new instance.

Exception Condition

stream 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