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

範例

下列程式代碼範例會顯示 SwitchLevelType 的屬性值 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.");
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

適用於