<configSections> の <remove> 要素

定義済みのセクションまたはセクション グループを削除します。

<configuration>
   <configSections>
      <remove>

<remove name="section name or section group name" />

必須属性

属性 説明
name 削除するセクションまたはセクション グループの名前を指定します。

解説

<remove> 要素を使用して、構成ファイル階層の上位レベルで定義されているセクションおよびセクション グループをアプリケーションから削除できます。

アプリケーション構成ファイルで <remove> 要素を使用して、マシン構成ファイルで定義済みのセクションを削除する例を示します。

セクション <sampleSection> を宣言するマシン構成ファイルのコードは、次のとおりです。

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

<sampleSection> セクションを削除するアプリケーション構成ファイルのコードは、次のとおりです。削除後、アプリケーションは <sampleSection> の設定を取得できません。

<!-- Application configuration file. -->
<configuration>
   <configSections>
      <remove name="sampleSection"/>
   </configSections>
</configuration>

構成ファイル

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

参照

構成セクション スキーマ | 構成セクションの設定