TraceSource.Switch Property

Gets or sets the source switch value.

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

public SourceSwitch Switch { get; set; }

Property Value

Type: System.Diagnostics.SourceSwitch
A SourceSwitch object representing the source switch value.

ExceptionCondition
ArgumentNullException

Switch is set to null.

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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft