ValidationException Constructors

Definition

Initializes a new instance of the ValidationException class.

Overloads

ValidationException()

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

ValidationException(String)

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

ValidationException(SerializationInfo, StreamingContext)

Initializes a new instance of the ValidationException class with serialized data.

ValidationException(String, Exception)

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

ValidationException()

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

C#
public ValidationException();

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

ValidationException(String)

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

C#
public ValidationException(string message);

Parameters

message
String

The error message that explains the reason for the exception.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

ValidationException(SerializationInfo, StreamingContext)

Initializes a new instance of the ValidationException class with serialized data.

C#
protected ValidationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);

Parameters

info
SerializationInfo

The SerializationInfo that holds the serialized object data about the exception being thrown.

context
StreamingContext

The StreamingContext that contains contextual information about the source or destination.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

ValidationException(String, Exception)

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

C#
public ValidationException(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, or a null reference (Nothing in Visual Basic) if no inner exception is specified.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1