System.Collections.Generic.KeyNotFoundException Class

public class KeyNotFoundException: SystemException

Base Types

Object
  Exception
    SystemException
      KeyNotFoundException

Assembly

mscorlib

Library

BCL

Summary

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

System.Collections.Generic Namespace

Members

KeyNotFoundException Constructors

KeyNotFoundException() Constructor
KeyNotFoundException(System.String) Constructor
KeyNotFoundException(System.String, System.Exception) Constructor


KeyNotFoundException() Constructor

public KeyNotFoundException()

Summary

Constructs and initializes a new instance of the System.KeyNotFoundException class.

Description

This constructor initializes the System.KeyNotFoundException.Message property of the new instance to a system-supplied message that describes the error, such as "An application error has occurred." This message takes into account the current system culture.

The System.KeyNotFoundException.InnerException property is initialized to null .

See Also

System.Collections.Generic.KeyNotFoundException Class, System.Collections.Generic Namespace

KeyNotFoundException(System.String) Constructor

public KeyNotFoundException(string message)

Summary

Constructs and initializes a new instance of the System.KeyNotFoundException class.

Parameters

message
The message that describes the error. The content of message is intended to be understandable to the user. The caller of this constructor is required to ensure that this string has been localized for the current system culture.

Description

This constructor initializes the System.KeyNotFoundException.Message property of the new instance using message. If message is null , the System.KeyNotFoundException.Message property is initialized to an implementation-specific message. The System.KeyNotFoundException.InnerException property is initialized to null .

See Also

System.Collections.Generic.KeyNotFoundException Class, System.Collections.Generic Namespace

KeyNotFoundException(System.String, System.Exception) Constructor

public KeyNotFoundException(string message, Exception innerException)

Summary

Constructs and initializes a new instance of the System.KeyNotFoundException class.

Parameters

message
The message that describes the error. The content of message is intended to be understandable to the user. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
innerException
An instance of Exception that is the cause of the current Exception. If innerException is non-null , then the current exception was raised in a catch block handling innerException.

Description

This constructor initializes the System.KeyNotFoundException.Message property of the new instance using message, and the System.KeyNotFoundException.InnerException property using innerException. If message is null , the System.KeyNotFoundException.Message property is initialized to an implementation-specific message.

[Note: For information on inner exceptions, see System.Exception.InnerException.]

See Also

System.Collections.Generic.KeyNotFoundException Class, System.Collections.Generic Namespace