TextWriterTraceListener Constructor (TextWriter^, String^)
Initializes a new instance of the TextWriterTraceListener class with the specified name, using the specified writer as recipient of the tracing or debugging output.
Assembly: System (in System.dll)
Parameters
- writer
-
Type:
System.IO::TextWriter^
A TextWriter that receives the output from the TextWriterTraceListener.
- name
-
Type:
System::String^
The name of the new instance.
| Exception | Condition |
|---|---|
| ArgumentNullException | The writer is null. |
The following code example creates a TextWriterTraceListener using the TextWriterTraceListener(TextWriter^, String^) constructor. The example creates a StreamWriter, then references the StreamWriter when it creates the TextWriterTraceListener, which it then adds to the TraceListenerCollection. The example writes two messages to this TextWriterTraceListener, then writes a message to all TraceListener objects in the TraceListenerCollection. Finally, it flushes and closes the TextWriterTraceListener.
Available since 1.1