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

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

Determines whether the dictionary contains an element with a specific key.

public bool ContainsKey (TKey key)

Parameters

key
The key to locate in the dictionary.

Returns

true, if an element whose key is key is found in the dictionary; otherwise, false.

Exceptions

TypeReason
ArgumentNullExceptionkey is null.

Remarks

This implementation is close to O(1) in most cases.

Requirements

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