<clear> Element for NameValueSectionHandler and DictionarySectionHandler
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
<!-- Machine.config file.--> <configuration> <configSections> <section name="mySection" type="System.Configuration.NameValueSectionHandler,System" /> </sectionGroup> </configSections> <mySection> <add key="key1" value="value1" /> <add key="key2" value="value2" /> </mySection> </configuration>
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> <mySection> <clear/> </mySection> </configuration>
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.