.NET Framework Class Library
ConfigurationElementCollection..::.BaseClear Method

Updated: November 2007

Removes all configuration element objects from the collection.

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

Visual Basic (Declaration)
Protected Friend Sub BaseClear
Visual Basic (Usage)
Me.BaseClear()
C#
protected internal void BaseClear()
Visual C++
protected public:
void BaseClear()
J#
protected void BaseClear()
JScript
protected internal function BaseClear()
ExceptionCondition
ConfigurationErrorsException

The configuration is read-only.

- or -

A collection item has been locked in a higher-level configuration.

When the BaseClear method is called, it removes all ConfigurationElement objects from the collection. It also inserts a clear directive into the configuration file.

The following code example shows how to call the BaseClear method.

Visual Basic
Public Sub Clear() 
    BaseClear()

End Sub 'Clear ' Add custom code here.

C#
public void Clear()
{
    BaseClear();
    // Add custom code here.
}

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Page view tracker