다음을 통해 공유


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

적용 대상