Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Clear Method

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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft