Class ArgumentException
The exception that is thrown when one of the arguments provided to a method is not valid.
Inheritance
Inherited Members
Namespace: System
Assembly: mscorlib.dll
Syntax
public class ArgumentException : SystemException
Constructors
| Improve this Doc View SourceArgumentException()
Initializes a new instance of the ArgumentException class.
Declaration
public ArgumentException()
ArgumentException(String)
Initializes a new instance of the ArgumentException class with a specified error message.
Declaration
public ArgumentException(string message)
Parameters
Type | Name | Description |
---|---|---|
String | message | 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.
Declaration
public ArgumentException(string message, Exception innerException)
Parameters
Type | Name | Description |
---|---|---|
String | message | The error message that explains the reason for the exception. |
Exception | innerException | 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.
Declaration
public ArgumentException(string message, string paramName)
Parameters
Type | Name | Description |
---|---|---|
String | message | The error message that explains the reason for the exception. |
String | paramName | 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.
Declaration
public ArgumentException(string message, string paramName, Exception innerException)
Parameters
Type | Name | Description |
---|---|---|
String | message | The error message that explains the reason for the exception. |
String | paramName | The name of the parameter that caused the current exception. |
Exception | innerException | 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
| Improve this Doc View SourceMessage
Gets the error message and the parameter name, or only the error message if no parameter name is set.
Declaration
public override string Message { get; }
Property Value
Type | Description |
---|---|
String | A text string describing the details of the exception. |
Overrides
| Improve this Doc View SourceParamName
Gets the name of the parameter that causes this exception.
Declaration
public virtual string ParamName { get; }
Property Value
Type | Description |
---|---|
String | The parameter name. |