This documentation is archived and is not being maintained.

<clear> Element for NameValueSectionHandler and DictionarySectionHandler

.NET Framework 1.1

Clears all previously defined settings in a section.

      <section name>



You can use the <clear> element to remove all settings from your application that were defined at a higher level in the configuration file hierarchy.


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

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

<!-- Machine.config file.-->
      <section name="mySection"
         type="System.Configuration.NameValueSectionHandler,System" />
      <add key="key1" value="value1" />
      <add key="key2" value="value2" />

The following application configuration file code removes all settings from <mySection>. The application cannot retrieve any of the settings that were declared in the in the <mySection> section of the machine configuration file.

<!-- Application configuration file. -->

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