次の方法で共有


NameValueSectionHandler および DictionarySectionHandler の <add> 要素

カスタム アプリケーション設定を追加します。<add> タグには、キーと値のペアが 1 組ずつ含まれます。

<configuration>
**      <section name>**
**         <add>**

<add
   key="key"   value="value"/>

必須属性

属性 説明
key 設定の名前を指定します。
value 設定の値を指定します。

カスタム構成セクションを定義し、<add> 要素を使用して設定をセクションに追加する例を示します。

<configuration>
   <configSections>
      <section name="dictionarySample"
         type="System.Configuration.DictionarySectionHandler,System"/>
   </configSections>
   <dictionarySample>
      <add key="myKey" value="myValue"/>
   </dictionarySample>
</configuration>

構成ファイル

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

参照

構成セクション スキーマ | 構成セクションの設定 | NameValueSectionHandler および DictionarySectionHandler のカスタム要素