ConfigurationElementCollection.CreateNewElement 方法

定義

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

多載

CreateNewElement(String)

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

CreateNewElement()

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

備註

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

CreateNewElement(String)

來源:
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 類別中覆寫。

給繼承者的注意事項

如果您建立包含異質ConfigurationElement類型的自訂ConfigurationElementCollection集合,您必須執行下列步驟:

適用於

CreateNewElement()

來源:
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 類別中覆寫。

適用於