Table of Contents

Class ArgumentException

Namespace
System
Assembly
mscorlib.dll

The exception that is thrown when one of the arguments provided to a method is not valid.

public class ArgumentException : SystemException
Inheritance
ArgumentException
Derived
Inherited Members
Extension Methods

Constructors

ArgumentException()

Initializes a new instance of the ArgumentException class.

public ArgumentException()

ArgumentException(string)

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

public ArgumentException(string message)

Parameters

message string

The error message that explains the reason for the exception.

ArgumentException(string, Exception)

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

public ArgumentException(string message, Exception innerException)

Parameters

message string

The error message that explains the reason for the exception.

innerException Exception

The exception that is the cause of 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.

ArgumentException(string, string)

Initializes a new instance of the ArgumentException class with a specified error message and the name of the parameter that causes this exception.

public ArgumentException(string message, string paramName)

Parameters

message string

The error message that explains the reason for the exception.

paramName string

The name of the parameter that caused the current exception.

ArgumentException(string, string, Exception)

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

public ArgumentException(string message, string paramName, Exception innerException)

Parameters

message string

The error message that explains the reason for the exception.

paramName string

The name of the parameter that caused the current exception.

innerException Exception

The exception that is the cause of 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.

Properties

Message

Gets the error message and the parameter name, or only the error message if no parameter name is set.

public override string Message { get; }

Property Value

string

A text string describing the details of the exception.

ParamName

Gets the name of the parameter that causes this exception.

public virtual string ParamName { get; }

Property Value

string

The parameter name.