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

When overridden in a derived class, creates a new ConfigurationElement.

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

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

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() _
    As ConfigurationElement

    Return New UrlConfigElement()
End Function 'CreateNewElement
C#
protected override 
    ConfigurationElement CreateNewElement()
{
    return new UrlConfigElement();
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, 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
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
Page view tracker