次の方法で共有


Switch コンストラクター

定義

Switch クラスの新しいインスタンスを初期化します。

オーバーロード

名前 説明
Switch(String, String)

Switch クラスの新しいインスタンスを初期化します。

Switch(String, String, String)

スイッチの表示名、説明、既定値を指定して、 Switch クラスの新しいインスタンスを初期化します。

Switch(String, String)

ソース:
Switch.cs
ソース:
Switch.cs
ソース:
Switch.cs
ソース:
Switch.cs
ソース:
Switch.cs

Switch クラスの新しいインスタンスを初期化します。

protected:
 Switch(System::String ^ displayName, System::String ^ description);
protected Switch(string displayName, string? description);
protected Switch(string displayName, string description);
new System.Diagnostics.Switch : string * string -> System.Diagnostics.Switch
Protected Sub New (displayName As String, description As String)

パラメーター

displayName
String

スイッチの名前。

description
String

スイッチの説明。

注釈

新しい Switch オブジェクトを作成すると、 displayName パラメーターの値を使用して初期スイッチ設定が検索されます。 既定値は空の文字列 ("") です。

.NET Framework アプリの XML 構成ファイル内で、スイッチを追加してその値を設定したり、スイッチを削除したり、アプリケーションによって以前に設定されたすべてのスイッチをクリアしたりできます。 アプリケーションの実行中、構成ファイルに対する動的な変更は検出されません。 構成ファイルへの変更が有効になる前に、アプリケーションを停止して再起動する必要があります。 構成ファイルは、次の例のように書式設定する必要があります。

<configuration>
  <system.diagnostics>
    <switches>
      <add name="mySwitch" value="10" />
      <add name="myNewSwitch" value="20" />
      <remove name="mySwitch" />
      <clear/>
    </switches>
  </system.diagnostics>
</configuration>

注意 (継承者)

スイッチの値を設定するには、コンストラクターで SwitchSetting プロパティを設定します。

こちらもご覧ください

適用対象

Switch(String, String, String)

ソース:
Switch.cs
ソース:
Switch.cs
ソース:
Switch.cs
ソース:
Switch.cs
ソース:
Switch.cs

スイッチの表示名、説明、既定値を指定して、 Switch クラスの新しいインスタンスを初期化します。

protected:
 Switch(System::String ^ displayName, System::String ^ description, System::String ^ defaultSwitchValue);
protected Switch(string displayName, string? description, string defaultSwitchValue);
protected Switch(string displayName, string? description, string? defaultSwitchValue);
protected Switch(string displayName, string description, string defaultSwitchValue);
new System.Diagnostics.Switch : string * string * string -> System.Diagnostics.Switch
Protected Sub New (displayName As String, description As String, defaultSwitchValue As String)

パラメーター

displayName
String

スイッチの名前。

description
String

スイッチの説明。

defaultSwitchValue
String

スイッチの既定値。

注釈

displayName パラメーターを使用してDisplayName プロパティの値を設定し、description パラメーターを使用してDescription プロパティの値を設定します。 defaultSwitchValue パラメーターは、Value プロパティがコードまたは構成ファイル属性によって設定されていない場合のスイッチの値です。 詳細については、 Switch(String, String) オーバーロードを参照してください。

適用対象