Share via


SwitchAttribute(String, Type) Constructeur

Définition

Initialise une nouvelle instance de la classe SwitchAttribute et spécifie le nom et le type du commutateur.

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ètres

switchName
String

Nom complet du commutateur.

switchType
Type

Type du commutateur.

Exemples

L’exemple de code suivant montre l’utilisation du SwitchAttribute constructeur pour créer un attribut switch. Cet exemple de code fait partie d’un exemple plus grand fourni pour la TraceSource classe .

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

Remarques

Le switchName paramètre doit correspondre à la DisplayName propriété du commutateur.

S’applique à