ConfigurationElementCollection.BaseClear 方法

定义

从集合中移除所有配置元素对象。Removes all configuration element objects from the collection.

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 ()

例外

配置是只读的。The configuration is read-only.

- 或 --or-

集合项已在更高级别的配置中锁定。A collection item has been locked in a higher-level configuration.

示例

下面的代码示例演示如何调用 BaseClear 方法。The following code example shows how to call the BaseClear 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

注解

BaseClear调用方法时,它将 ConfigurationElement 从集合中移除所有对象。When the BaseClear method is called, it removes all ConfigurationElement objects from the collection. 它还会将 clear 指令插入到配置文件中。It also inserts a clear directive into the configuration file.

适用于