Mono Class Library: System.Collections.Generic.Dictionary<TKey,TValue> Overview | Members

System.Collections.Generic.Dictionary<TKey,TValue>.Remove Method

Removes the element with the specified key from the dictionary.

public bool Remove (TKey key)

Parameters

key
The key of the element to be removed from the dictionary.

Returns

true if the element containing key is successfully removed; otherwise, false. This method also returns false if key was not found in the dictionary.

Exceptions

TypeReason
ArgumentNullExceptionkey is null.

Remarks

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

This method shall be implemented with efficiency that is at least an O(1) operation.

Requirements

Namespace: System.Collections.Generic
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0