Share via


ArgumentException Constructor (String, Exception)

Initializes a new instance of the ArgumentException class with a specified error message and a reference to the inner exception that caused the current exception.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

public ArgumentException (
         stringmessage,
         ExceptioninnerException
)

Parameters

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

Remarks

This constructor initializes the Message property of the new instance of the ArgumentException class, using the value of the message parameter. The content of the message parameter is intended to be understood by humans. The caller of this constructor should ensure that this string has been localized for the current system culture.

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

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, and 4.1.

See Also

Reference

ArgumentException Class
ArgumentException Members
System Namespace