TextWriterTraceListener.Writer 属性

定义

获取或设置接收跟踪或调试输出的文本编写器。

public:
 property System::IO::TextWriter ^ Writer { System::IO::TextWriter ^ get(); void set(System::IO::TextWriter ^ value); };
public System.IO.TextWriter? Writer { get; set; }
public System.IO.TextWriter Writer { get; set; }
member this.Writer : System.IO.TextWriter with get, set
Public Property Writer As TextWriter

属性值

表示接收跟踪或调试输出的编写器的 TextWriter

示例

以下示例创建一个 TextWriterTraceListener 写入控制台屏幕的 。 然后,代码将新的跟踪侦听器添加到 Listeners 跟踪类中的 。

#if defined(TRACE)
TextWriterTraceListener^ myWriter = gcnew TextWriterTraceListener;
myWriter->Writer = System::Console::Out;
Trace::Listeners->Add( myWriter );
#endif

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

适用于

另请参阅