Validator::ValidateValue Method (Object^, ValidationContext^, IEnumerable<ValidationAttribute^>^)

 

Validates the specified attributes.

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

public:
static void ValidateValue(
	Object^ value,
	ValidationContext^ validationContext,
	IEnumerable<ValidationAttribute^>^ validationAttributes
)

Parameters

value
Type: System::Object^

The value to validate.

validationContext
Type: System.ComponentModel.DataAnnotations::ValidationContext^

The context that describes the object to validate.

validationAttributes
Type: System.Collections.Generic::IEnumerable<ValidationAttribute^>^

The validation attributes.

Exception Condition
ArgumentNullException

The validationContext parameter is null.

ValidationException

The value parameter does not validate with the validationAttributes parameter.

This method tests each validation attribute in the validationAttributes parameter against the value parameter. If a RequiredAttribute attribute is included, the RequiredAttribute attribute is evaluated first.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 3.0
Return to top
Show: