Share via


SwitchAttribute.GetAll(Assembly) Méthode

Définition

Retourne tous les attributs de commutateur pour l'assembly spécifié.

public:
 static cli::array <System::Diagnostics::SwitchAttribute ^> ^ GetAll(System::Reflection::Assembly ^ assembly);
public static System.Diagnostics.SwitchAttribute[] GetAll (System.Reflection.Assembly assembly);
static member GetAll : System.Reflection.Assembly -> System.Diagnostics.SwitchAttribute[]
Public Shared Function GetAll (assembly As Assembly) As SwitchAttribute()

Paramètres

assembly
Assembly

L'assembly dont vous recherchez les attributs de commutateur.

Retours

Tableau qui contient tous les attributs de commutateur pour l'assembly.

Exceptions

assembly a la valeur null.

Exemples

L’exemple de code suivant montre l’utilisation de la GetAll méthode pour identifier les commutateurs utilisés dans un assembly. Cet exemple de code fait partie d’un exemple plus grand fourni pour la TraceSource classe .

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

S’applique à