TraceSource.Switch 属性

定义

获取或设置源开关的值。Gets or sets the source switch value.

public:
 property System::Diagnostics::SourceSwitch ^ Switch { System::Diagnostics::SourceSwitch ^ get(); void set(System::Diagnostics::SourceSwitch ^ value); };
public System.Diagnostics.SourceSwitch Switch { get; set; }
member this.Switch : System.Diagnostics.SourceSwitch with get, set
Public Property Switch As SourceSwitch

属性值

SourceSwitch

表示源开关值的 SourceSwitch 对象。A SourceSwitch object representing the source switch value.

例外

Switch 设置为 nullSwitch is set to null.

注解

Switch属性允许在跟踪源调用侦听器之前筛选消息。The Switch property allows the filtering of messages before the trace source calls the listeners.

开关用于检查是否应生成或忽略跟踪调用。The switch is used to check whether trace calls should be generated or ignored. 每个跟踪方法调用的 ShouldTrace 方法 SourceSwitch 来确定是否继续跟踪。Each trace method calls the ShouldTrace method of the SourceSwitch to determine whether to proceed with the trace. 如果调用返回 true ,则调用侦听器。If the call returns true, the listeners are called.

适用于