TraceSource.Switch Property

Gets or sets the source switch value.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

public SourceSwitch Switch { get; set; }
/** @property */
public SourceSwitch get_Switch ()

/** @property */
public void set_Switch (SourceSwitch value)

public function get Switch () : SourceSwitch

public function set Switch (value : SourceSwitch)

Not applicable.

Property Value

A SourceSwitch object representing the source switch value.

Exception typeCondition


Switch is set to a null reference (Nothing in Visual Basic).

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. Each trace method calls the ShouldTrace method of the SourceSwitch to determine whether to proceed with the trace. If the call returns true, the listeners are called.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions