ConfigurationElementCollection.CreateNewElement ConfigurationElementCollection.CreateNewElement ConfigurationElementCollection.CreateNewElement ConfigurationElementCollection.CreateNewElement Method

Definition

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

Overloads

CreateNewElement(String) CreateNewElement(String) CreateNewElement(String) CreateNewElement(String)

Creates a new ConfigurationElement when overridden in a derived class.

CreateNewElement() CreateNewElement() CreateNewElement() CreateNewElement()

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

Remarks

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.

CreateNewElement(String) CreateNewElement(String) CreateNewElement(String) CreateNewElement(String)

Creates a new ConfigurationElement when overridden in a derived class.

protected:
 virtual System::Configuration::ConfigurationElement ^ CreateNewElement(System::String ^ elementName);
protected virtual System.Configuration.ConfigurationElement CreateNewElement (string elementName);
abstract member CreateNewElement : string -> System.Configuration.ConfigurationElement
override this.CreateNewElement : string -> System.Configuration.ConfigurationElement
Protected Overridable Function CreateNewElement (elementName As String) As ConfigurationElement

Parameters

elementName
String String String String

The name of the ConfigurationElement to create.

Returns

Remarks

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.

Notes to Inheritors

If you create a custom ConfigurationElementCollection collection that contains heterogeneous ConfigurationElement types, you must perform these steps:

CreateNewElement() CreateNewElement() CreateNewElement() CreateNewElement()

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

protected:
 abstract System::Configuration::ConfigurationElement ^ CreateNewElement();
protected abstract System.Configuration.ConfigurationElement CreateNewElement ();
abstract member CreateNewElement : unit -> System.Configuration.ConfigurationElement
Protected MustOverride Function CreateNewElement () As ConfigurationElement

Returns

Examples

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

protected override ConfigurationElement CreateNewElement()
{
    return new UrlConfigElement();
}
Protected Overloads Overrides Function CreateNewElement() As ConfigurationElement
    Return New UrlConfigElement()
End Function

Remarks

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.

Applies to