ConfigurationElementCollection.CreateNewElement 方法

定义

在派生类中重写时,创建新的 ConfigurationElement

重载

名称 说明
CreateNewElement(String)

在派生类中重写时创建新的 ConfigurationElement

CreateNewElement()

在派生类中重写时,创建新的 ConfigurationElement

注解

CreateNewElement重写方法以创建自定义ConfigurationElement类型的对象。 从配置文件加载集合时, CreateNewElement 将调用以创建单个元素。 CreateNewElement 必须在派生自该类的 ConfigurationElementCollection 类中重写。

CreateNewElement(String)

Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs

在派生类中重写时创建新的 ConfigurationElement

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

参数

elementName
String

要创建的名称 ConfigurationElement

返回

具有指定名称的新 ConfigurationElement 项。

注解

CreateNewElement重写方法以创建自定义ConfigurationElement类型的对象。 从配置文件加载集合时, CreateNewElement 将调用以创建单个元素。 CreateNewElement 必须在派生自该类的 ConfigurationElementCollection 类中重写。

继承者说明

如果创建自定义 ConfigurationElementCollection 集合,其中包含异类 ConfigurationElement 类型,则必须执行以下步骤:

适用于

CreateNewElement()

Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs

在派生类中重写时,创建新的 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

返回

新建 ConfigurationElement的 。

示例

下面的代码示例演示如何重写 CreateNewElement 方法。

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

注解

CreateNewElement重写方法以创建自定义ConfigurationElement类型的对象。 从配置文件加载集合时, CreateNewElement 将调用以创建单个元素。 CreateNewElement 必须在派生自该类的 ConfigurationElementCollection 类中重写。

适用于