mscorlib 2.0.0.0 4.0.0.0 System.SystemException System.Runtime.InteropServices.ComVisible(true)

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

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

For a list of initial property values for an instance of the class, see the constructors.

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

- Constructor
  2.0.0.0
  4.0.0.0

  This constructor initializes the property of the new instance to a system-supplied message that describes the error, such as "The given key was not present in the dictionary." This message takes into account the current system culture.

  The following table shows the initial property values for an instance of the class.

  Property

  Value

  null.

  The localized error message string.

  Initializes a new instance of the class using default property values.

- Constructor
  2.0.0.0
  4.0.0.0

  The content of the parameter is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.

  The following table shows the initial property values for an instance of the class.

  Property

  Value

  null.

  The localized error message string.

  Initializes a new instance of the class with the specified error message.

  The message that describes the error.
- Constructor
  2.0.0.0
  4.0.0.0

  This constructor is called during deserialization to reconstitute the exception object transmitted over a stream. For more information, see XML and Soap Serialization.

  Initializes a new instance of the class with serialized data.

  The that holds the serialized object data about the exception being thrown.
  The that contains contextual information about the source or destination.
- Constructor
  2.0.0.0
  4.0.0.0

  An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the property. The property returns the same value that is passed into the constructor, or null if the property does not supply the inner exception value to the constructor.

  The following table shows the initial property values for an instance of the class.

  Property

  Value

  The inner exception reference.

  The localized error message string.

  Initializes a new instance of the class with the specified error message and a reference to the inner exception that is the cause of this exception.

  The error message that explains the reason for the exception.
  The exception that is the cause of the current exception. If the parameter is not null, the current exception is raised in a catch block that handles the inner exception.