TraceSource::Switch Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the source switch value.

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

public:
property SourceSwitch^ Switch {
	SourceSwitch^ get();
	[SecurityPermissionAttribute(SecurityAction::LinkDemand, Flags = SecurityPermissionFlag::UnmanagedCode)]
	void set(SourceSwitch^ value);
}

Property Value

Type: System.Diagnostics::SourceSwitch^

A SourceSwitch object representing the source switch value.

Exception Condition
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.

SecurityPermission

for operating with unmanaged code. Demand value: LinkDemand; Associated enumeration: SecurityPermissionFlag::UnmanagedCode.

.NET Framework
Available since 2.0
Return to top
Show: