Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ConfigurationSectionGroup Class

 

Represents a group of related sections within a configuration file.

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)


public ref class ConfigurationSectionGroup 

NameDescription
System_CAPS_pubmethodConfigurationSectionGroup()

Initializes a new instance of the ConfigurationSectionGroup class.

NameDescription
System_CAPS_pubpropertyIsDeclarationRequired

Gets a value that indicates whether this ConfigurationSectionGroup object declaration is required.

System_CAPS_pubpropertyIsDeclared

Gets a value that indicates whether this ConfigurationSectionGroup object is declared.

System_CAPS_pubpropertyName

Gets the name property of this ConfigurationSectionGroup object.

System_CAPS_pubpropertySectionGroupName

Gets the section group name associated with this ConfigurationSectionGroup.

System_CAPS_pubpropertySectionGroups

Gets a ConfigurationSectionGroupCollection object that contains all the ConfigurationSectionGroup objects that are children of this ConfigurationSectionGroup object.

System_CAPS_pubpropertySections

Gets a ConfigurationSectionCollection object that contains all of ConfigurationSection objects within this ConfigurationSectionGroup object.

System_CAPS_pubpropertyType

Gets or sets the type for this ConfigurationSectionGroup object.

NameDescription
System_CAPS_pubmethodEquals(Object^)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodForceDeclaration()

Forces the declaration for this ConfigurationSectionGroup object.

System_CAPS_pubmethodForceDeclaration(Boolean)

Forces the declaration for this ConfigurationSectionGroup object.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodShouldSerializeSectionGroupInTargetVersion(FrameworkName^)

Indicates whether the current ConfigurationSectionGroup instance should be serialized when the configuration object hierarchy is serialized for the specified target version of the .NET Framework.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

Settings in configuration files (such as the Web.config file) are organized into sections. Because some sections are related, it is often convenient to group them in a section group. The ConfigurationSectionGroup class represents the sectionGroup XML element that is used to group sections when they are defined in the configSections element of a configuration file. Section groups can be nested (a section group can contain other section groups as well as sections). The following example shows a configSections element that defines three nested section groups:

<configSections>
  <sectionGroup name="system.web.extensions"...>
    <sectionGroup name="scripting" ...>
      <section name="scriptResourceHandler".../>
      <sectionGroup name="webServices"...>
        <section name="jsonSerialization" .../>
        <section name="profileService" ... />        <section name="authenticationService" .../>
        <section name="roleService" .../>
      </sectionGroup>
    </sectionGroup>
  </sectionGroup>
</configSections>

The configuration system loads settings from configuration files into ConfigurationSectionGroup objects. You can use the Sections and SectionGroups properties to access the sections and section groups that are contained in a ConfigurationSectionGroup object.

For more information about how to access information from configuration files, see the ConfigurationManager class.

The following example shows how to use the ConfigurationSectionGroup class to retrieve configuration settings. The example is a console application that reads configuration settings and writes information about each configuration section group and the sections in it to the console.

The Main method loads the configuration settings into a Configuration object, retrieves the SectionGroups collection from the Configuration object, and then calls the ShowSectionGroupCollectionInfo method to display the section property values.

The ShowSectionGroupCollectionInfo method iterates through the section groups and calls the ShowSectionGroupInfo method for each one.

The ShowSectionGroupInfo method displays the name of the section group, some property values, and the names of the sections that it contains. If the section group contains section groups, this method calls ShowSectionGroupCollectionInfo recursively to display those section groups.

The indentLevel field is used to add spaces to the left side of displayed lines to show logical groupings. All lines are limited to 79 characters of text to avoid line wrapping, which would make it harder to distinguish the logical groupings.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: