ConfigurationSectionGroupCollection.Get ConfigurationSectionGroupCollection.Get ConfigurationSectionGroupCollection.Get ConfigurationSectionGroupCollection.Get Method

Definition

Ruft ein ConfigurationSectionGroup-Objekt aus der Auflistung ab.Gets a ConfigurationSectionGroup object from the collection

Überlädt

Get(Int32) Get(Int32) Get(Int32) Get(Int32)

Ruft das angegebene ConfigurationSectionGroup-Objekt in der Auflistung ab.Gets the specified ConfigurationSectionGroup object contained in the collection.

Get(String) Get(String) Get(String) Get(String)

Ruft das angegebene ConfigurationSectionGroup-Objekt aus der Auflistung ab.Gets the specified ConfigurationSectionGroup object from the collection.

Hinweise

Diese Methode ist ein Wrapper um die BaseGet Methode.This method is a wrapper around the BaseGet method.

Get(Int32) Get(Int32) Get(Int32) Get(Int32)

Ruft das angegebene ConfigurationSectionGroup-Objekt in der Auflistung ab.Gets the specified ConfigurationSectionGroup object contained in the collection.

public:
 System::Configuration::ConfigurationSectionGroup ^ Get(int index);
public System.Configuration.ConfigurationSectionGroup Get (int index);
member this.Get : int -> System.Configuration.ConfigurationSectionGroup
Public Function Get (index As Integer) As ConfigurationSectionGroup

Parameter

index
Int32 Int32 Int32 Int32

Der Index des zurückzugebenden ConfigurationSectionGroup-Objekts.The index of the ConfigurationSectionGroup object to be returned.

Gibt zurück

Hinweise

Diese Methode ist ein Wrapper um die BaseGet Methode.This method is a wrapper around the BaseGet method.

Get(String) Get(String) Get(String) Get(String)

Ruft das angegebene ConfigurationSectionGroup-Objekt aus der Auflistung ab.Gets the specified ConfigurationSectionGroup object from the collection.

public:
 System::Configuration::ConfigurationSectionGroup ^ Get(System::String ^ name);
public System.Configuration.ConfigurationSectionGroup Get (string name);
member this.Get : string -> System.Configuration.ConfigurationSectionGroup
Public Function Get (name As String) As ConfigurationSectionGroup

Parameter

name
String String String String

Der Name des zurückzugebenden ConfigurationSectionGroup-Objekts.The name of the ConfigurationSectionGroup object to be returned.

Gibt zurück

Ausnahmen

name ist NULL oder eine leere Zeichenfolge ("").name is null or an empty string ("").

Beispiele

Im folgenden Codebeispiel wird die Verwendung der Get-Methode veranschaulicht.The following code example shows how to use the Get method.

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());
    }
}
Shared Sub GetGroup()
   
   Try
         Dim config _
         As System.Configuration.Configuration = _
         ConfigurationManager.OpenExeConfiguration( _
         ConfigurationUserLevel.None)

         Dim groups _
         As ConfigurationSectionGroupCollection = _
         config.SectionGroups

         Dim customGroup _
         As ConfigurationSectionGroup = _
         groups.Get("CustomGroup")
      
      
      If customGroup Is Nothing Then
             Console.WriteLine( _
             "Failed to load CustomGroup.")
      Else
         ' Display section information
             Console.WriteLine("Name:       {0}", _
             customGroup.Name)
             Console.WriteLine("Type:   {0}", _
             customGroup.Type)
      End If
   
   
   Catch err As ConfigurationErrorsException
      Console.WriteLine(err.ToString())
   End Try
End Sub 'GetGroup

Hinweise

Diese Methode ist ein Wrapper um die BaseGet Methode.This method is a wrapper around the BaseGet method.

Siehe auch

Gilt für: