SwitchAttribute(String, Type) Konstruktor

Definíció

Inicializálja az SwitchAttribute osztály új példányát, megadva a kapcsoló nevét és típusát.

public:
 SwitchAttribute(System::String ^ switchName, Type ^ switchType);
public SwitchAttribute(string switchName, Type switchType);
new System.Diagnostics.SwitchAttribute : string * Type -> System.Diagnostics.SwitchAttribute
Public Sub New (switchName As String, switchType As Type)

Paraméterek

switchName
String

A kapcsoló megjelenítendő neve.

switchType
Type

A kapcsoló típusa.

Példák

Az alábbi kód példája a konstruktor kapcsolóattribútum létrehozására való használatát SwitchAttribute mutatja be. Ez a példakód egy nagyobb, az TraceSource osztályhoz tartozó példa része.

[SwitchAttribute("SourceSwitch", typeof(SourceSwitch))]
static void Main()
<SwitchAttribute("SourceSwitch", GetType(SourceSwitch))> _
Shared Sub Main()

Megjegyzések

A switchName paraméternek meg kell egyeznie a DisplayName kapcsoló tulajdonságával.

A következőre érvényes: