ValidationAttribute Constructors

Definition

Initializes a new instance of the ValidationAttribute class.

Overloads

ValidationAttribute()

Initializes a new instance of the ValidationAttribute class.

ValidationAttribute(Func<String>)

Initializes a new instance of the ValidationAttribute class by using the function that enables access to validation resources.

ValidationAttribute(String)

Initializes a new instance of the ValidationAttribute class by using the error message to associate with a validation control.

ValidationAttribute()

Initializes a new instance of the ValidationAttribute class.

protected:
 ValidationAttribute();
protected ValidationAttribute ();
Protected Sub New ()

Remarks

For more information about this API, see <see href="/dotnet/fundamentals/runtime-libraries/system-componentmodel-dataannotations-validationattribute--ctor">Supplemental API remarks for System.ComponentModel.DataAnnotations.ValidationAttribute..ctor</see>.

Applies to

ValidationAttribute(Func<String>)

Initializes a new instance of the ValidationAttribute class by using the function that enables access to validation resources.

protected:
 ValidationAttribute(Func<System::String ^> ^ errorMessageAccessor);
protected ValidationAttribute (Func<string> errorMessageAccessor);
new System.ComponentModel.DataAnnotations.ValidationAttribute : Func<string> -> System.ComponentModel.DataAnnotations.ValidationAttribute
Protected Sub New (errorMessageAccessor As Func(Of String))

Parameters

errorMessageAccessor
Func<String>

The function that enables access to validation resources.

Exceptions

errorMessageAccessor is null.

Remarks

This constructor provides a resource accessor function that is used by the ErrorMessageString property to retrieve an error message.

Applies to

ValidationAttribute(String)

Initializes a new instance of the ValidationAttribute class by using the error message to associate with a validation control.

protected:
 ValidationAttribute(System::String ^ errorMessage);
protected ValidationAttribute (string errorMessage);
new System.ComponentModel.DataAnnotations.ValidationAttribute : string -> System.ComponentModel.DataAnnotations.ValidationAttribute
Protected Sub New (errorMessage As String)

Parameters

errorMessage
String

The error message to associate with a validation control.

Applies to