//</Snippet4>

        //<Snippet5>
        static void GetEnumerator()
        {
            try
            {
                System.Configuration.Configuration config =
                    ConfigurationManager.OpenExeConfiguration(
                        ConfigurationUserLevel.None);

                ConfigurationSectionCollection sections =
                    config.Sections;

                IEnumerator secEnum =
                    sections.GetEnumerator();

                //<Snippet6>
                int i = 0;
                while (secEnum.MoveNext())
                {
                    string setionName = sections.GetKey(i);
                    Console.WriteLine(
                        "Section name: {0}", setionName);
                    i += 1;
                }
                //</Snippet6>
            }
            catch (ConfigurationErrorsException err)
            {
                Console.WriteLine(err.ToString());
            }
        }
        public void SectionCollectionEnumerator()
        {
            SysConfig c = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            ConfigurationSectionCollection col =
                c.GetSectionGroup("system.web").Sections;
            IEnumerator e = col.GetEnumerator();

            e.MoveNext();
            Assert.IsTrue(e.Current is ConfigurationSection);
        }