IDictionary.Clear 方法

定義

將所有項目從 IDictionary 物件移除。Removes all elements from the IDictionary object.

public:
 void Clear();
public void Clear ();
abstract member Clear : unit -> unit
Public Sub Clear ()

例外狀況

IDictionary 物件為唯讀。The IDictionary object is read-only.

範例

下列程式碼範例示範如何執行 Clear 方法。The following code example demonstrates how to implement the Clear method. 這個程式碼範例是針對類別提供之較大範例的一部分 IDictionaryThis code example is part of a larger example provided for the IDictionary class.

public:
    virtual void Clear()
    {
        itemsInUse = 0;
    }
public void Clear() { ItemsInUse = 0; }
Public Sub Clear() Implements IDictionary.Clear
    ItemsInUse = 0
End Sub

適用於