Clear Method
Collapse the table of content
Expand the table of content

ConfigurationSectionGroupCollection.Clear Method ()

 

Clears the collection.

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)

public void Clear()

This method is a wrapper around the BaseClear method.

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

static void Clear()
{

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

        config.SectionGroups.Clear();

        config.Save(ConfigurationSaveMode.Full);
    }
    catch (ConfigurationErrorsException err)
    {
        Console.WriteLine(err.ToString());
    }
}

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft