ConfigurationElementCollection.CreateNewElement Method (String)

Creates a new ConfigurationElement when overridden in a derived class.

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

protected virtual ConfigurationElement CreateNewElement (
	string elementName
)
protected ConfigurationElement CreateNewElement (
	String elementName
)
protected function CreateNewElement (
	elementName : String
) : ConfigurationElement
Not applicable.

Parameters

elementName

The name of the ConfigurationElement to create.

Return Value

A new 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.

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

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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: