SwitchLevelAttribute.SwitchLevelType Property


Gets or sets the type that determines whether a trace should be written.

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

public Type SwitchLevelType { get; set; }

Property Value

Type: System.Type

The Type that determines whether a trace should be written.

Exception Condition

The set operation failed because the value is null.

The level property of a switch is not necessarily named Level; for example, the level property of the BooleanSwitch class is Enabled.

The following code example displays the value of the SwitchLevelType property for the BooleanSwitch.

// Display the SwitchLevelAttribute for the BooleanSwitch.
Object[] attribs = typeof(BooleanSwitch).GetCustomAttributes(typeof(SwitchLevelAttribute), false);
if (attribs.Length == 0)
    Console.WriteLine("Error, couldn't find SwitchLevelAttribute on BooleanSwitch.");

.NET Framework
Available since 2.0
Return to top