ValidationAttribute::Validate Method (Object^, String^)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Validates the specified object.

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

public:
void Validate(
	Object^ value,
	String^ name
)

Parameters

value
Type: System::Object^

The value of the object to validate.

name
Type: System::String^

The name to include in the error message.

Exception Condition
ValidationException

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
Show: