語言

ConfigurationElementCollection.CreateNewElement 方法

定義

在衍生類別中覆寫時,建立新的 ConfigurationElement。

多載

名稱 Description
CreateNewElement(String)

在衍生類別中覆寫時,建立新的 ConfigurationElement。

CreateNewElement()

在衍生類別中覆寫時,建立新的 ConfigurationElement。

備註

覆寫 CreateNewElement 建立特定類型自訂 ConfigurationElement 物件的方法。 當從組態檔案載入集合時, CreateNewElement 會被呼叫來建立個別元素。 CreateNewElement 必須在從該 ConfigurationElementCollection 類別衍生的類別中覆寫。

CreateNewElement(String)

來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
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()

來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
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 類別衍生的類別中覆寫。

適用於