Share via


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

속성 값

스위치의 형식입니다.

예외

SwitchTypenull로 설정됩니다.

예제

다음 코드 예제에서는 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

적용 대상