ConfigurationElementCollection.CreateNewElement Metoda

Definicja

Po przesłonięciu w klasie pochodnej tworzy nowy ConfigurationElementelement .

Przeciążenia

CreateNewElement(String)

Tworzy nowy ConfigurationElement element po przesłonięciu w klasie pochodnej.

CreateNewElement()

Po przesłonięciu w klasie pochodnej tworzy nowy ConfigurationElementelement .

Uwagi

Zastąpij metodę CreateNewElement , aby utworzyć obiekty niestandardowe ConfigurationElement określonego typu. Gdy kolekcja zostanie załadowana z pliku konfiguracji, zostanie wywołana w CreateNewElement celu utworzenia poszczególnych elementów. CreateNewElement należy zastąpić klasami pochodzącymi z ConfigurationElementCollection klasy.

CreateNewElement(String)

Źródło:
ConfigurationElementCollection.cs
Źródło:
ConfigurationElementCollection.cs
Źródło:
ConfigurationElementCollection.cs

Tworzy nowy ConfigurationElement element po przesłonięciu w klasie pochodnej.

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

Parametry

elementName
String

Nazwa elementu do utworzenia ConfigurationElement .

Zwraca

Nowa ConfigurationElement o określonej nazwie.

Uwagi

Zastąpij metodę CreateNewElement , aby utworzyć obiekty niestandardowe ConfigurationElement określonego typu. Gdy kolekcja zostanie załadowana z pliku konfiguracji, zostanie wywołana w CreateNewElement celu utworzenia poszczególnych elementów. CreateNewElement należy zastąpić klasami pochodzącymi z ConfigurationElementCollection klasy.

Uwagi dotyczące dziedziczenia

W przypadku utworzenia kolekcji niestandardowej ConfigurationElementCollection zawierającej typy heterogeniczne ConfigurationElement należy wykonać następujące kroki:

Dotyczy

CreateNewElement()

Źródło:
ConfigurationElementCollection.cs
Źródło:
ConfigurationElementCollection.cs
Źródło:
ConfigurationElementCollection.cs

Po przesłonięciu w klasie pochodnej tworzy nowy ConfigurationElementelement .

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

Zwraca

Nowo utworzony ConfigurationElementelement .

Przykłady

Poniższy przykład kodu pokazuje, jak zastąpić metodę CreateNewElement .

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

Uwagi

Zastąpij metodę CreateNewElement , aby utworzyć obiekty niestandardowe ConfigurationElement określonego typu. Gdy kolekcja zostanie załadowana z pliku konfiguracji, zostanie wywołana w CreateNewElement celu utworzenia poszczególnych elementów. CreateNewElement należy zastąpić klasami pochodzącymi z ConfigurationElementCollection klasy.

Dotyczy