共用方式為


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)

適用於

另請參閱