This documentation is archived and is not being maintained.

TextWriterTraceListener.Writer Property

Gets or sets the text writer that receives the tracing or debugging output.

[Visual Basic]
Public Property Writer As TextWriter
[C#]
public TextWriter Writer {get; set;}
[C++]
public: __property TextWriter* get_Writer();
public: __property void set_Writer(TextWriter*);
[JScript]
public function get Writer() : TextWriter;
public function set Writer(TextWriter);

Property Value

A TextWriter that represents the writer that receives the tracing or debugging output.

Example

[Visual Basic, C#, C++] The following example creates a TextWriterTraceListener that writes to the console screen. Then the code adds the new trace listener to the Listeners in the trace class.

[Visual Basic] 
Dim myWriter As New TextWriterTraceListener()
myWriter.Writer = System.Console.Out
Trace.Listeners.Add(myWriter)

[C#] 

 TextWriterTraceListener myWriter = new TextWriterTraceListener();
    myWriter.Writer = System.Console.Out;
    Trace.Listeners.Add(myWriter);
    

[C++] 

 TextWriterTraceListener* myWriter = new TextWriterTraceListener();
    myWriter->Writer = System::Console::Out;
    Trace::Listeners->Add(myWriter);
    

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

TextWriterTraceListener Class | TextWriterTraceListener Members | System.Diagnostics Namespace | TraceListener | DefaultTraceListener | EventLogTraceListener | TextWriterTraceListener | Stream | TextWriter | Debug | Trace

Show: