ConfigurationElementCollection.BaseRemove(Object) Method

Definition

Removes a ConfigurationElement from the collection.

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

Parameters

key
Object

The key of the ConfigurationElement to remove.

Exceptions

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.

Examples

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

Remarks

The BaseRemove method inserts a <remove> directive into the configuration file for the ConfigurationElement with the specified key.

Applies to