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 組態檔中。

適用於