ConfigurationElementCollection.BaseAdd Metoda

Definicja

Dodaje element ConfigurationElement do ConfigurationElementCollection wystąpienia podczas zastępowania w klasie pochodnej.

Przeciążenia

BaseAdd(ConfigurationElement)

Dodaje element konfiguracji do elementu ConfigurationElementCollection.

BaseAdd(ConfigurationElement, Boolean)

Dodaje element konfiguracji do kolekcji elementów konfiguracji.

BaseAdd(Int32, ConfigurationElement)

Dodaje element konfiguracji do kolekcji elementów konfiguracji.

Uwagi

BaseAdd Użyj metody , aby dodać nową ConfigurationElement do kolekcji. Przesłoń w klasie pochodnej, jeśli zachowanie niestandardowe jest wymagane po dodaniu elementu.

Podczas dodawania element jest uznawany za duplikat tylko wtedy, gdy klucze są identyczne, ale wartości są różne. Elementy z identycznymi kluczami i wartościami są akceptowane w trybie dyskretnym, ponieważ elementy nie konkurują. Nie można jednak dodać elementu o identycznym kluczu, ale nie można dodać innej wartości, ponieważ nie ma logiki określania, która z konkurencyjnych wartości powinna być honorowana.

BaseAdd(ConfigurationElement)

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

Dodaje element konfiguracji do elementu ConfigurationElementCollection.

protected:
 virtual void BaseAdd(System::Configuration::ConfigurationElement ^ element);
protected virtual void BaseAdd (System.Configuration.ConfigurationElement element);
abstract member BaseAdd : System.Configuration.ConfigurationElement -> unit
override this.BaseAdd : System.Configuration.ConfigurationElement -> unit
Protected Overridable Sub BaseAdd (element As ConfigurationElement)

Parametry

element
ConfigurationElement

Element do dodania ConfigurationElement .

Przykłady

W poniższym przykładzie kodu pokazano, jak zastąpić metodę BaseAdd i jak ją wywołać z Add metody .

public void Add(UrlConfigElement url)
{
    BaseAdd(url);

    // Your custom code goes here.
}
Public Sub Add(ByVal url As UrlConfigElement)
    BaseAdd(url)

    ' Your custom code goes here.

End Sub

Uwagi

BaseAdd Użyj metody , aby dodać nową ConfigurationElement do kolekcji. Zastąp go w klasie pochodnej, jeśli zachowanie niestandardowe jest wymagane po dodaniu elementu.

Podczas dodawania element jest uznawany za duplikat tylko wtedy, gdy klucze są identyczne, ale wartości są różne. Elementy z identycznymi kluczami i wartościami są akceptowane w trybie dyskretnym, ponieważ elementy nie konkurują. Nie można jednak dodać elementu o identycznym kluczu, ale nie można dodać innej wartości, ponieważ nie ma logiki określania, która z konkurencyjnych wartości powinna być honorowana.

Dotyczy

BaseAdd(ConfigurationElement, Boolean)

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

Dodaje element konfiguracji do kolekcji elementów konfiguracji.

protected:
 void BaseAdd(System::Configuration::ConfigurationElement ^ element, bool throwIfExists);
protected public:
 void BaseAdd(System::Configuration::ConfigurationElement ^ element, bool throwIfExists);
protected void BaseAdd (System.Configuration.ConfigurationElement element, bool throwIfExists);
protected internal void BaseAdd (System.Configuration.ConfigurationElement element, bool throwIfExists);
member this.BaseAdd : System.Configuration.ConfigurationElement * bool -> unit
Protected Sub BaseAdd (element As ConfigurationElement, throwIfExists As Boolean)
Protected Friend Sub BaseAdd (element As ConfigurationElement, throwIfExists As Boolean)

Parametry

element
ConfigurationElement

Element do dodania ConfigurationElement .

throwIfExists
Boolean

true aby zgłosić wyjątek, jeśli ConfigurationElement określony jest już zawarty w elemecie ConfigurationElementCollection; w przeciwnym razie false.

Wyjątki

Element do dodania ConfigurationElement już istnieje w obiekcie ConfigurationElementCollection , a throwIfExists parametr to true.

Uwagi

Użyj opcjonalnego parametru throwIfExists , aby zgłosić Exception wyjątek, jeśli określony ConfigurationElement obiekt już istnieje w kolekcji ConfigurationElementCollection .

Element jest uważany za duplikat tylko wtedy, gdy klucze są identyczne, ale wartości są różne. Elementy z identycznymi kluczami i wartościami są akceptowane w trybie dyskretnym, ponieważ elementy nie konkurują. Nie można jednak dodać elementu o identycznym kluczu, ale nie można dodać innej wartości, ponieważ nie ma logiki określania, która z konkurencyjnych wartości powinna być honorowana.

Dotyczy

BaseAdd(Int32, ConfigurationElement)

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

Dodaje element konfiguracji do kolekcji elementów konfiguracji.

protected:
 virtual void BaseAdd(int index, System::Configuration::ConfigurationElement ^ element);
protected virtual void BaseAdd (int index, System.Configuration.ConfigurationElement element);
abstract member BaseAdd : int * System.Configuration.ConfigurationElement -> unit
override this.BaseAdd : int * System.Configuration.ConfigurationElement -> unit
Protected Overridable Sub BaseAdd (index As Integer, element As ConfigurationElement)

Parametry

index
Int32

Lokalizacja indeksu, w której należy dodać określony ConfigurationElementelement .

element
ConfigurationElement

Element do dodania ConfigurationElement .

Uwagi

Użyj parametru indexConfigurationElement , aby dodać obiekt do ConfigurationElementCollection określonej lokalizacji indeksu.

Dotyczy