Edit

Share via


Custom element for SingleTagSectionHandler

Defines settings in a custom configuration section that is defined by a <section> element and uses the SingleTagSectionHandler class.

<configuration>
  <sectionName>

Syntax

XML
<sectionName key="value" key2="value2" />

Attributes

Attributes and attribute values are user defined.

Parent element

Description
<configuration> The root element in every configuration file used by the common language runtime and .NET Framework applications.

Child elements

None

Remarks

The <sectionName> element is a custom element defined by a <section> tag in the <configSections> element. The configuration system returns a IDictionary object when you call Configuration.GetSection(String).

Example

The following example declares a custom element called <sampleSection> that contains settings read by the SingleTagSectionHandler class:

XML
<configuration>
  <configSections>
    <section name="sampleSection"
             type="System.Configuration.SingleTagSectionHandler" />
  </configSections>
  <sampleSection setting1="Value1"
                 setting2="value two"
                 setting3="third value" />
</configuration>

Configuration file

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

See also