ConfigurationSectionGroupCollection.Keys Property    
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the keys to all ConfigurationSectionGroup objects contained in this ConfigurationSectionGroupCollection object.
public:
 virtual property System::Collections::Specialized::NameObjectCollectionBase::KeysCollection ^ Keys { System::Collections::Specialized::NameObjectCollectionBase::KeysCollection ^ get(); };public override System.Collections.Specialized.NameObjectCollectionBase.KeysCollection Keys { get; }member this.Keys : System.Collections.Specialized.NameObjectCollectionBase.KeysCollectionPublic Overrides ReadOnly Property Keys As NameObjectCollectionBase.KeysCollectionProperty Value
A NameObjectCollectionBase.KeysCollection object that contains the names of all section groups in this collection.
Examples
The following code example shows how to use the Keys property.
// Get the collection keys i.e., the
// group names.
static void GetKeys()
{
    try
    {
        System.Configuration.Configuration config =
        ConfigurationManager.OpenExeConfiguration(
        ConfigurationUserLevel.None);
        ConfigurationSectionGroupCollection groups =
            config.SectionGroups;
        foreach (string key in groups.Keys)
        {
            Console.WriteLine(
             "Key value: {0}", key);
        }
    }
    catch (ConfigurationErrorsException err)
    {
        Console.WriteLine(err.ToString());
    }
}
' Get the collection keys i.e., the
' group names.
Shared Sub GetKeys()
   
   Try
         Dim config _
       As System.Configuration.Configuration = _
       ConfigurationManager.OpenExeConfiguration( _
       ConfigurationUserLevel.None)
         Dim groups _
         As ConfigurationSectionGroupCollection = _
         config.SectionGroups
      Dim key As String
      For Each key In  groups.Keys
         
         Console.WriteLine("Key value: {0}", key)
      Next key
   
   
   Catch err As ConfigurationErrorsException
      Console.WriteLine(err.ToString())
   End Try
End Sub