SwitchAttribute(String, Type) コンストラクター

定義

スイッチの名前と型を指定して、SwitchAttribute クラスの新しいインスタンスを初期化します。

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)

パラメーター

switchName
String

スイッチの表示名。

switchType
Type

スイッチの型。

次のコード例は、コンストラクターを使用して SwitchAttribute switch 属性を作成する方法を示しています。 このコード例は、TraceSource クラスのために提供されている大規模な例の一部です。

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

注釈

パラメーターは switchName 、スイッチの プロパティと DisplayName 一致する必要があります。

適用対象