TraceListener.TraceOutputOptions 屬性

定義

取得或設定追蹤輸出選項。

public:
 property System::Diagnostics::TraceOptions TraceOutputOptions { System::Diagnostics::TraceOptions get(); void set(System::Diagnostics::TraceOptions value); };
public System.Diagnostics.TraceOptions TraceOutputOptions { get; set; }
[System.Runtime.InteropServices.ComVisible(false)]
public System.Diagnostics.TraceOptions TraceOutputOptions { get; set; }
member this.TraceOutputOptions : System.Diagnostics.TraceOptions with get, set
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.TraceOutputOptions : System.Diagnostics.TraceOptions with get, set
Public Property TraceOutputOptions As TraceOptions

屬性值

列舉值的位元組合。 預設為 None

屬性

例外狀況

設定作業失敗,因為值無效。

範例

下列範例顯示主控台追蹤接聽程式的 屬性設定 TraceOutputOptions 。 主控台追蹤接聽程式是在追蹤來源的 屬性中 Listeners 列舉的其中一個接聽程式。 此程式碼範例是提供給 類別之較大範例的 TraceSource 一部分。

ts.Listeners["console"].TraceOutputOptions |= TraceOptions.Callstack;
ts.Listeners("console").TraceOutputOptions = ts.Listeners("console").TraceOutputOptions Or TraceOptions.Callstack

備註

屬性 TraceOutputOptions 會決定追蹤輸出的選擇性內容。 屬性可以在組態檔中設定,或在執行期間以程式設計方式設定,以特別包含程式碼區段的其他資料。 例如,您可以設定 TraceOutputOptions 主控台追蹤接聽程式的 屬性, TraceOptions.Callstack 將呼叫堆疊資訊新增至追蹤輸出。

TraceOptions下列類別和方法不會使用列舉:

適用於