次の方法で共有


SingleTagSectionHandler のカスタム要素

<section> 要素によって定義され、SingleTagSectionHandler クラスを使用するカスタム構成セクションの設定を定義します。

configuration
   <sectionName>

構文

<sectionName key="value" key2="value2" />

属性

属性と属性値はユーザーが定義します。

親要素

説明
configuration 共通言語ランタイムおよび .NET Framework アプリケーションで使用されるすべての構成ファイルのルート要素です。

子要素

なし

解説

<sectionName> 要素は、<configSections> 要素内の <section> タグによって定義されるカスタム要素です。 Configuration.GetSection(String) を呼び出すと、構成システムから IDictionary オブジェクトが返されます。

次の例では、SingleTagSectionHandler クラスによって読み取られた設定を含む <sampleSection> というカスタム要素を宣言しています。

<configuration>
  <configSections>
    <section name="sampleSection"
             type="System.Configuration.SingleTagSectionHandler" />
  </configSections>
  <sampleSection setting1="Value1"
                 setting2="value two"
                 setting3="third value" />
</configuration>

構成ファイル

この要素は、アプリケーション構成ファイル、マシン構成ファイル (Machine.config)、およびアプリケーション ディレクトリ レベルではない Web.config ファイルで使用できます。

関連項目