ConfigurationSectionGroupCollection.Item[String] ConfigurationSectionGroupCollection.Item[String] ConfigurationSectionGroupCollection.Item[String] ConfigurationSectionGroupCollection.Item[String] Property

Definition

Überlädt

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Ruft das ConfigurationSectionGroup-Objekt aus der Auflistung ab, dessen Index angegeben ist.Gets the ConfigurationSectionGroup object whose index is specified from the collection.

Item[String] Item[String] Item[String] Item[String]

Ruft das ConfigurationSectionGroup-Objekt aus der Auflistung ab, dessen Name angegeben ist.Gets the ConfigurationSectionGroup object whose name is specified from the collection.

Beispiele

Im folgenden Beispiel wird gezeigt, wie Sie die Item[String]-Eigenschaft verwenden, um eine ConfigurationSectionGroupCollection zu durchlaufen.The following example shows how to use the Item[String] property to iterate through a ConfigurationSectionGroupCollection.

static void ShowSectionGroupCollectionInfo(ConfigurationSectionGroupCollection mySectionGroupCollection)
{
    foreach (String mySectionGroupName in mySectionGroupCollection.Keys)
    {
        ConfigurationSectionGroup mySectionGroup = 
            (ConfigurationSectionGroup)mySectionGroupCollection[mySectionGroupName];
        ShowSectionGroupInfo(mySectionGroup);
    }
}
Shared Sub ShowSectionGroupCollectionInfo(mySectionGroupCollection As System.Configuration.ConfigurationSectionGroupCollection)
    Dim mySectionGroupName As String
    For Each mySectionGroupName In  mySectionGroupCollection.Keys
        Dim mySectionGroup As System.Configuration.ConfigurationSectionGroup = CType(mySectionGroupCollection(mySectionGroupName), System.Configuration.ConfigurationSectionGroup)
        ShowSectionGroupInfo(mySectionGroup)
    Next mySectionGroupName
End Sub

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Ruft das ConfigurationSectionGroup-Objekt aus der Auflistung ab, dessen Index angegeben ist.Gets the ConfigurationSectionGroup object whose index is specified from the collection.

public:
 property System::Configuration::ConfigurationSectionGroup ^ default[int] { System::Configuration::ConfigurationSectionGroup ^ get(int index); };
public System.Configuration.ConfigurationSectionGroup this[int index] { get; }
member this.Item(int) : System.Configuration.ConfigurationSectionGroup
Default Public ReadOnly Property Item(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.

Eigenschaftswert

Das ConfigurationSectionGroup-Objekt am angegebenen Index.The ConfigurationSectionGroup object at the specified index.

In C# ist diese Eigenschaft der Indexer für die ConfigurationSectionCollection-Klasse.In C#, this property is the indexer for the ConfigurationSectionCollection class.

Item[String] Item[String] Item[String] Item[String]

Ruft das ConfigurationSectionGroup-Objekt aus der Auflistung ab, dessen Name angegeben ist.Gets the ConfigurationSectionGroup object whose name is specified from the collection.

public:
 property System::Configuration::ConfigurationSectionGroup ^ default[System::String ^] { System::Configuration::ConfigurationSectionGroup ^ get(System::String ^ name); };
public System.Configuration.ConfigurationSectionGroup this[string name] { get; }
member this.Item(string) : System.Configuration.ConfigurationSectionGroup
Default Public ReadOnly Property Item(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.

Eigenschaftswert

Das ConfigurationSectionGroup-Objekt mit dem angegebenen Namen.The ConfigurationSectionGroup object with the specified name.

In C# ist diese Eigenschaft der Indexer für die ConfigurationSectionCollection-Klasse.In C#, this property is the indexer for the ConfigurationSectionCollection class.

Beispiele

Im folgenden Codebeispiel wird die Verwendung der Item[String]-Eigenschaft veranschaulicht.The following code example shows how to use the Item[String] property.

static void GetItems()
{

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

        ConfigurationSectionGroupCollection groups =
            config.SectionGroups;

        ConfigurationSectionGroup group1 =
            groups.Get("system.net");

        ConfigurationSectionGroup group2 =
        groups.Get("system.web");


        Console.WriteLine(
             "Group1: {0}", group1.Name);

        Console.WriteLine(
            "Group2: {0}", group2.Name);

    }
    catch (ConfigurationErrorsException err)
    {
        Console.WriteLine(err.ToString());
    }
}

Shared Sub GetItems()
   
   Try
         Dim config _
     As System.Configuration.Configuration = _
     ConfigurationManager.OpenExeConfiguration( _
     ConfigurationUserLevel.None)

         Dim groups _
         As ConfigurationSectionGroupCollection = _
         config.SectionGroups

         Dim group1 As ConfigurationSectionGroup = _
         groups.Get("system.net")
      
         Dim group2 As ConfigurationSectionGroup = _
         groups.Get("system.web")
      
      
      Console.WriteLine("Group1: {0}", group1.Name)
      
      Console.WriteLine("Group2: {0}", group2.Name)
   
   Catch err As ConfigurationErrorsException
      Console.WriteLine(err.ToString())
   End Try
End Sub

Siehe auch

Gilt für: