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. 此代码示例是为IDictionary类提供的更大示例的一部分。This 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

适用于