SwitchLevelAttribute.SwitchLevelType Property

Definition

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

C#
public Type SwitchLevelType { get; set; }

Property Value

The Type that determines whether a trace should be written.

Exceptions

The set operation failed because the value is null.

Examples

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

C#
// 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.");
else
    Console.WriteLine(((SwitchLevelAttribute)attribs[0]).SwitchLevelType.ToString());

Remarks

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

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1