ConfigurationElementCollection.BaseRemove(Object) 方法

定义

从集合中删除 ConfigurationElement 对象。Removes a ConfigurationElement from the collection.

protected:
 void BaseRemove(System::Object ^ key);
protected public:
 void BaseRemove(System::Object ^ key);
protected void BaseRemove (object key);
protected internal void BaseRemove (object key);
member this.BaseRemove : obj -> unit
Protected Sub BaseRemove (key As Object)
Protected Friend Sub BaseRemove (key As Object)

参数

key
Object

要移除的 ConfigurationElement 的键。The key of the ConfigurationElement to remove.

例外

集合中不存在具有指定键的 ConfigurationElement,该元素已被移除,或者由于该元素的 Type 值不是 AddRemoveClearMap,因此无法移除该元素。No ConfigurationElement with the specified key exists in the collection, the element has already been removed, or the element cannot be removed because the value of its Type is not AddRemoveClearMap.

示例

下面的代码示例演示如何调用 BaseRemove 方法。The following code example shows how to call the BaseRemove method.

public void Remove(UrlConfigElement url)
{
    if (BaseIndexOf(url) >= 0)
    {
        BaseRemove(url.Name);
        // Your custom code goes here.
        Console.WriteLine("UrlsCollection: {0}", "Removed collection element!");
    }
}
Public Sub Remove(ByVal url As UrlConfigElement)
    If BaseIndexOf(url) >= 0 Then
        BaseRemove(url.Name)
        ' Your custom code goes here.
        Console.WriteLine("UrlsCollection: {0}", "Removed collection element!")
    End If
End Sub

注解

BaseRemove 方法将 <remove> 指令插入具有指定键的 ConfigurationElement 的配置文件中。The BaseRemove method inserts a <remove> directive into the configuration file for the ConfigurationElement with the specified key.

适用于