TextWriterTraceListener.Writer 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置接收跟踪或调试输出的文本编写器。
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)