This documentation is archived and is not being maintained.

ConfigurationElementCollection.CreateNewElement Method (String)

Note: This method is new in the .NET Framework version 2.0.

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



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 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0