System.Collections.Hashtable.Remove Method

Removes the element with the specified key from the Hashtable.

Syntax

[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)]
public virtual void Remove (object key)

Parameters

key
The key of the element to remove.

Exceptions

TypeReason
ArgumentNullException key is null.
NotSupportedExceptionThe current instance is read-only or has a fixed size.

Remarks

If the Hashtable does not contain an element with the specified key, the Hashtable remains unchanged. No exception is thrown.

This method is an O(1) operation.

Requirements

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