.NET Framework Class Library
ConfigurationElementCollection..::.CreateNewElement Method (String)

Creates a new ConfigurationElement when overridden in a derived class.

Namespace:  System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)
Visual Basic (Declaration)
Protected Overridable Function CreateNewElement ( _
    elementName As String _
) As ConfigurationElement
Visual Basic (Usage)
Dim elementName As String
Dim returnValue As ConfigurationElement

returnValue = Me.CreateNewElement(elementName)
C#
protected virtual ConfigurationElement CreateNewElement(
    string elementName
)
Visual C++
protected:
virtual ConfigurationElement^ CreateNewElement(
    String^ elementName
)
JScript
protected function CreateNewElement(
    elementName : String
) : ConfigurationElement

Parameters

elementName
Type: System..::.String
The name of the ConfigurationElement to create.

Override the CreateNewElement method to create custom ConfigurationElement objects of a specific type. When a collection is loaded from the configuration file, CreateNewElement is called to create individual elements. CreateNewElement must be overridden in classes that derive from the ConfigurationElementCollection class.

The following code example shows how to override the CreateNewElement method.

Visual Basic
Protected Overloads Overrides Function CreateNewElement( _
    ByVal elementName As String) _
    As ConfigurationElement

    Return New UrlConfigElement(elementName)
End Function 'CreateNewElement

C#
protected override 
    ConfigurationElement CreateNewElement(
    string elementName)
{
    return new UrlConfigElement(elementName);
}

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