SwitchAttribute.SwitchType Właściwość

Definicja

Pobiera lub ustawia typ przełącznika.

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

Wartość właściwości

Typ przełącznika.

Wyjątki

SwitchType parametr jest ustawiony na nullwartość .

Przykłady

Poniższy przykład kodu wyświetla wartość SwitchType właściwości dla wszystkich przełączników używanych w zestawie. Ten przykład kodu jest częścią większego przykładu udostępnionego TraceSource dla klasy .

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

Dotyczy