ConfigurationSectionGroupCollection.Clear Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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: