System.Collections.Generic.KeyNotFoundException Class

The exception that is thrown when the key specified for accessing an element in a collection does not match any key in the collection.

See Also: KeyNotFoundException Members


public class KeyNotFoundException : SystemException


A KeyNotFoundException is thrown when an operation attempts to retrieve an element from a collection using a key that does not exist in that collection.

KeyNotFoundException uses the HRESULT COR_E_KEYNOTFOUND, which has the value 0x80131577.

For a list of initial property values for an instance of the KeyNotFoundException class, see the erload:System.Collections.Generic.KeyNotFoundException.#ctor constructors.


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