Share via


SwitchAttribute.GetAll(Assembly) Metodo

Definizione

Restituisce tutti gli attributi delle opzioni per l'assembly specificato.

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()

Parametri

assembly
Assembly

Assembly per controllare gli attributi delle opzioni.

Restituisce

Matrice che contiene tutti gli attributi delle opzioni per l'assembly.

Eccezioni

assembly è null.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso del GetAll metodo per identificare le opzioni usate in un assembly. Questo esempio di codice fa parte di un esempio più ampio fornito per 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

Si applica a