ConfigurationElementCollection.BaseAdd 方法

定义

在派生类中重写时,ConfigurationElement向实例添加 aConfigurationElementCollection

重载

名称 说明
BaseAdd(ConfigurationElement)

将配置元素添加到 ConfigurationElementCollection

BaseAdd(ConfigurationElement, Boolean)

将配置元素添加到配置元素集合。

BaseAdd(Int32, ConfigurationElement)

将配置元素添加到配置元素集合。

注解

使用该方法 BaseAdd 向集合添加新 ConfigurationElement 内容。 如果在添加元素时需要自定义行为,则重写派生类。

添加时,仅当键相同但值不同时,才会将元素视为重复元素。 具有相同键和值的元素会以无提示方式接受,因为元素不会竞争。 但是,不能添加具有相同键但不能添加其他值的元素,因为没有逻辑来确定应遵循哪些竞争值。

BaseAdd(ConfigurationElement)

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

将配置元素添加到 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)

参数

element
ConfigurationElement

ConfigurationElement 添加的。

示例

下面的代码示例演示如何重写 BaseAdd 方法以及如何从 Add 方法调用该方法。

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

注解

使用该方法 BaseAdd 向集合添加新 ConfigurationElement 内容。 如果在添加元素时需要自定义行为,请将其重写在派生类中。

添加时,仅当键相同但值不同时,才会将元素视为重复元素。 具有相同键和值的元素会以无提示方式接受,因为元素不会竞争。 但是,不能添加具有相同键但不能添加其他值的元素,因为没有逻辑来确定应遵循哪些竞争值。

适用于

BaseAdd(ConfigurationElement, Boolean)

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

将配置元素添加到配置元素集合。

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);
protected void BaseAdd(System.Configuration.ConfigurationElement element, bool throwIfExists);
member this.BaseAdd : System.Configuration.ConfigurationElement * bool -> unit
Protected Friend Sub BaseAdd (element As ConfigurationElement, throwIfExists As Boolean)
Protected Sub BaseAdd (element As ConfigurationElement, throwIfExists As Boolean)

参数

element
ConfigurationElement

ConfigurationElement 添加的。

throwIfExists
Boolean

如果 指定的项已包含在中 ,则为 ;否则为 >。

例外

ConfigurationElement 添加的项已存在于该参数中 ConfigurationElementCollection ,并且 throwIfExists 参数为 true.

注解

如果集合中throwIfExists已存在指定的Exception对象,则使用可选参数ConfigurationElement引发ConfigurationElementCollection异常。

仅当键相同但值不同时,才会将元素视为重复元素。 具有相同键和值的元素会以无提示方式接受,因为元素不会竞争。 但是,不能添加具有相同键但不能添加其他值的元素,因为没有逻辑来确定应遵循哪些竞争值。

适用于

BaseAdd(Int32, ConfigurationElement)

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

将配置元素添加到配置元素集合。

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)

参数

index
Int32

要在其中添加指定 ConfigurationElement位置的索引位置。

element
ConfigurationElement

ConfigurationElement 添加的。

注解

使用 index 参数将 ConfigurationElement 对象添加到 ConfigurationElementCollection 特定索引位置。

适用于