Condividi tramite


SwitchAttribute(String, Type) Costruttore

Definizione

Inizializza una nuova istanza della SwitchAttribute classe , specificando il nome e il tipo dell'opzione.

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)

Parametri

switchName
String

Nome visualizzato dell'opzione.

switchType
Type

Tipo dell'opzione.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso del SwitchAttribute costruttore per creare un attributo switch. Questo esempio di codice fa parte di un esempio più ampio fornito per la TraceSource classe .

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

Commenti

Il switchName parametro deve corrispondere alla DisplayName proprietà dell'opzione.

Si applica a