SwitchAttribute.GetAll(Assembly) メソッド

定義

指定されたアセンブリのすべてのスイッチ属性を返します。

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

パラメーター

assembly
Assembly

スイッチ属性を確認する対象のアセンブリ。

戻り値

アセンブリのすべてのスイッチ属性を含む配列。

例外

assemblynullです。

次のコード例は、 メソッドを GetAll 使用してアセンブリで使用されるスイッチを識別する方法を示しています。 このコード例は、TraceSource クラスのために提供されている大規模な例の一部です。

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

適用対象