ConfigurationElementCollection.BaseClear 方法

定义

从集合中移除所有配置元素对象。

protected:
 void BaseClear();
protected public:
 void BaseClear();
protected void BaseClear ();
protected internal void BaseClear ();
member this.BaseClear : unit -> unit
Protected Sub BaseClear ()
Protected Friend Sub BaseClear ()

例外

配置是只读的。

- 或 -

集合项已在更高级别的配置中锁定。

示例

下面的代码示例演示如何调用 BaseClear 方法。

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

注解

BaseClear调用 方法时,它会从集合中删除所有ConfigurationElement对象。 它还在 clear 配置文件中插入 指令。

适用于