This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge
public ref class KeyNotFoundException : Exception
public ref class KeyNotFoundException : SystemException
public class KeyNotFoundException : Exception
public class KeyNotFoundException : SystemException
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class KeyNotFoundException : SystemException
type KeyNotFoundException = class
    inherit Exception
type KeyNotFoundException = class
    inherit SystemException
type KeyNotFoundException = class
    inherit SystemException
    interface ISerializable
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type KeyNotFoundException = class
    inherit SystemException
    interface ISerializable
Public Class KeyNotFoundException
Inherits Exception
Public Class KeyNotFoundException
Inherits SystemException
Inheritance
KeyNotFoundException

Remarks

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 KeyNotFoundException constructors.

Gets a collection of key/value pairs that provide additional user-defined information about the exception.

(Inherited from Exception )

When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.

(Inherited from Exception ) Obsolete.

When overridden in a derived class, sets the SerializationInfo with information about the exception.

(Inherited from Exception ) Obsolete.

Occurs when an exception is serialized to create an exception state object that contains serialized data about the exception.

(Inherited from Exception )