Share via


SwitchAttribute.SwitchName 속성

정의

스위치의 표시 이름을 가져오거나 설정합니다.

public:
 property System::String ^ SwitchName { System::String ^ get(); void set(System::String ^ value); };
public string SwitchName { get; set; }
member this.SwitchName : string with get, set
Public Property SwitchName As String

속성 값

스위치의 표시 이름입니다.

예외

SwitchNamenull로 설정됩니다.

SwitchName을 빈 문자열로 설정한 경우

예제

다음 코드 예제에서는 값을 표시 합니다 SwitchName 어셈블리에서 사용 하는 모든 스위치에 대 한 속성입니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 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

설명

속성은 SwitchName 스위치의 속성과 DisplayName 일치해야 합니다.

적용 대상