다음을 통해 공유


<remove> Element for <configSections>

Removes a predefined section or section group.

<configuration>
   <configSections>
      <remove>

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

Required Attributes

Attribute Description
name Specifies the name of the section or section group to remove.

Remarks

You can use the <remove> element to remove sections and section groups from your application that were defined at a higher level in the configuration file hierarchy.

Example

The following example shows how to use the <remove> element in an application configuration file to remove a section previously defined in the machine configuration file.

The following machine configuration file code declares the section <sampleSection>.

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

The following application configuration file code removes the <sampleSection> section. After removal, the application cannot retrieve the settings in <sampleSection>.

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

Configuration File

This element can be used in the application configuration file, machine configuration file (Machine.config), and Web.config files that are not at the application directory level.

See Also

Configuration Sections Schema | Configuration Section Settings