System.Collections.Hashtable.Clear Method

Removes all elements from the Hashtable.

Syntax

[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
public virtual void Clear ()

Exceptions

TypeReason
NotSupportedExceptionThe current instance is read-only.

Remarks

Hashtable.Count is set to zero, and references to other objects from elements of the collection are also released. The capacity remains unchanged.

This method is an O(n) operation, where n is Hashtable.Count.

Requirements

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0