Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Custom Element for NameValueSectionHandler and DictionarySectionHandler

.NET Framework 1.1

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

<configuration>
   <sectionName>

<sectionName> 
</sectionName>

Child Elements

Remarks

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.

Example

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.

<configuration>
   <configSections>
      <section name="dictionarySample"
         type="System.Configuration.DictionarySectionHandler,System"/>
      <sectionGroup name="mySectionGroup">
         <section name="mySection"
            type="System.Configuration.NameValueSectionHandler,System" />
      </sectionGroup>
   </configSections>
   <dictionarySample>
      <add key="myKey" value="myValue"/>
   </dictionarySample>
   <mySectionGroup>
      <mySection>
         <add key="key1" value="value1" />
      </mySection>
   </mySectionGroup>
</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

Show:
© 2015 Microsoft