Share via


SwitchLevelAttribute.SwitchLevelType 属性

定义

获取或设置用于确定是否应该写入跟踪的类型。

public:
 property Type ^ SwitchLevelType { Type ^ get(); void set(Type ^ value); };
public Type SwitchLevelType { get; set; }
member this.SwitchLevelType : Type with get, set
Public Property SwitchLevelType As Type

属性值

用于确定是否应该写入跟踪的 Type

例外

设置操作失败,原因是值为 null

示例

下面的代码示例显示 的 属性的值SwitchLevelTypeBooleanSwitch

// 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());
' Display the SwitchLevelAttribute for the BooleanSwitch.
Dim attribs As [Object]() = GetType(BooleanSwitch).GetCustomAttributes(GetType(SwitchLevelAttribute), False)
If attribs.Length = 0 Then
    Console.WriteLine("Error, couldn't find SwitchLevelAttribute on BooleanSwitch.")
Else
    Console.WriteLine(CType(attribs(0), SwitchLevelAttribute).SwitchLevelType.ToString())
End If

注解

开关的 level 属性不一定命名 Level;例如,类的 BooleanSwitch level 属性为 Enabled

适用于