SwitchAttribute.SwitchType 屬性

定義

取得或設定參數的型別。

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

屬性值

參數的型別。

例外狀況

SwitchType 設定為 null

範例

下列程式代碼範例會顯示元件中所使用之所有參數的 SwitchType 屬性值。 此程式代碼範例是提供給 類別之較大範例的 TraceSource 一部分。

SwitchAttribute[] switches = SwitchAttribute.GetAll(typeof(TraceTest).Assembly);
for (int i = 0; i < switches.Length; i++)
{
    Console.WriteLine("Switch name = " + switches[i].SwitchName);
    Console.WriteLine("Switch type = " + switches[i].SwitchType);
}
Dim switches As SwitchAttribute() = SwitchAttribute.GetAll(GetType(TraceTest).Assembly)
Dim i As Integer
For i = 0 To switches.Length - 1
    Console.WriteLine("Switch name = " + switches(i).SwitchName.ToString())
    Console.WriteLine("Switch type = " + switches(i).SwitchType.ToString())
Next i

適用於