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 类和方法不使用枚举:

适用于