Custom Element for NameValueSectionHandler and DictionarySectionHandler

Defines settings for custom configuration sections that use the NameValueSectionHandler or DictionarySectionHandler classes.

**   <sectionName>**


Child Elements

Element Description
<add> element for NameValueSectionHandler and DictionarySectionHandler Adds custom settings.
<remove> element for NameValueSectionHandler and DictionarySectionHandler Removes a previously defined setting.
<clear>element for NameValueSectionHandler and DictionarySectionHandler Clears all previously defined settings in a section.


The <sectionName> element is a custom element defined by a <section> tag in the <configSections> element.

The following table shows the type of object the ConfigurationSettings.GetConfig method returns for each configuration section handler.

Configuration section handler Return type
DictionarySectionHandler Systems.Collections.IDictionary
NameValueSectionHandler Systems.Collections.Specialized.NameValueCollection


The following example shows how to declare sections that use the DictionarySectionHandler and NameValueSectionHandler classes. The custom elements are <dictionarySample>, which contains settings read by the DictionarySectionHandler class, and <mySection>, which contains settings read by the NameValueSectionHandler class.

      <section name="dictionarySample"
      <sectionGroup name="mySectionGroup">
         <section name="mySection"
            type="System.Configuration.NameValueSectionHandler,System" />
      <add key="myKey" value="myValue"/>
         <add key="key1" value="value1" />

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