Прочетете на английски Редактиране

Споделяне чрез


ConfigurationSectionGroupCollection.Get Method

Definition

Gets a ConfigurationSectionGroup object from the collection.

Overloads

Get(Int32)

Gets the specified ConfigurationSectionGroup object contained in the collection.

Get(String)

Gets the specified ConfigurationSectionGroup object from the collection.

Remarks

This method is a wrapper around the BaseGet method.

Get(Int32)

Source:
ConfigurationSectionGroupCollection.cs
Source:
ConfigurationSectionGroupCollection.cs
Source:
ConfigurationSectionGroupCollection.cs
Source:
ConfigurationSectionGroupCollection.cs
Source:
ConfigurationSectionGroupCollection.cs
Source:
ConfigurationSectionGroupCollection.cs

Gets the specified ConfigurationSectionGroup object contained in the collection.

C#
public System.Configuration.ConfigurationSectionGroup Get(int index);

Parameters

index
Int32

The index of the ConfigurationSectionGroup object to be returned.

Returns

The ConfigurationSectionGroup object at the specified index.

Remarks

This method is a wrapper around the BaseGet method.

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (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, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

Get(String)

Source:
ConfigurationSectionGroupCollection.cs
Source:
ConfigurationSectionGroupCollection.cs
Source:
ConfigurationSectionGroupCollection.cs
Source:
ConfigurationSectionGroupCollection.cs
Source:
ConfigurationSectionGroupCollection.cs
Source:
ConfigurationSectionGroupCollection.cs

Gets the specified ConfigurationSectionGroup object from the collection.

C#
public System.Configuration.ConfigurationSectionGroup Get(string name);

Parameters

name
String

The name of the ConfigurationSectionGroup object to be returned.

Returns

The ConfigurationSectionGroup object with the specified name.

Exceptions

name is null or an empty string ("").

Examples

The following code example shows how to use the Get method.

C#
static void GetGroup()
{

    try
    {
        System.Configuration.Configuration config =
        ConfigurationManager.OpenExeConfiguration(
        ConfigurationUserLevel.None);

        ConfigurationSectionGroup customGroup =
            config.SectionGroups.Get("CustomGroup");

        if (customGroup == null)
            Console.WriteLine(
                "Failed to load CustomSection.");
        else
        {
            // Display section information
            Console.WriteLine("Section group name:       {0}",
                customGroup.SectionGroupName);
            Console.WriteLine("Name:       {0}",
                customGroup.Name);
            Console.WriteLine("Type:   {0}",
                customGroup.Type);
        }
    }
    catch (ConfigurationErrorsException err)
    {
        Console.WriteLine(err.ToString());
    }
}

Remarks

This method is a wrapper around the BaseGet method.

See also

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (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, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10