Validate Method (Object, String)
Collapse the table of content
Expand the table of content

ValidationAttribute.Validate Method (Object, String)


Validates the specified object.

Namespace:   System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

public void Validate(
	object value,
	string name


Type: System.Object

The value of the object to validate.

Type: System.String

The name to include in the error message.

Exception Condition

value is not valid.

This method validates the value of the object or property on which the ValidationAttribute attribute is declared. It calls the IsValid method and passes value as a parameter. If validation fails, a ValidationException exception is thrown.

Universal Windows Platform
Available since 10
.NET Framework
Available since 3.5
Return to top
© 2015 Microsoft