Configuration.SectionGroups Property

Definition

Gets a collection of the section groups defined by this configuration.

C#
public System.Configuration.ConfigurationSectionGroupCollection SectionGroups { get; }

Property Value

A ConfigurationSectionGroupCollection collection representing the collection of section groups for this Configuration object.

Examples

The following code example demonstrates how to use the SectionGroups property.

C#
ConfigurationSectionGroupCollection
    groups = config.SectionGroups;
Console.WriteLine("Groups: {0}", groups.Count.ToString());
foreach (ConfigurationSectionGroup group in groups)
{
    Console.WriteLine("Group Name: {0}", group.Name);
   // Console.WriteLine("Group Type: {0}", group.Type);
}

Remarks

Configuration sections can be combined into groups for convenience and added functionality. Access the SectionGroups property to retrieve the ConfigurationSectionGroupCollection object representing the collection of section groups for this Configuration object. If this Configuration object represents an inherited view, the merged list of section groups will be returned.

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9