Validator.ValidateProperty Method

Determines whether the specified property value is valid and throws a ValidationException if the property is not valid.

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

public static void ValidateProperty(
	Object value,
	ValidationContext validationContext
)

Parameters

value
Type: System.Object
The value to validate.
validationContext
Type: System.ComponentModel.DataAnnotations.ValidationContext
An object that contains information about the validation request.

ExceptionCondition
ArgumentException

MemberName of validationContext is not a valid property.

ValidationException

value is not valid.

The ValidateProperty method tests each ValidationAttribute attribute that is associated with the property identified by the validationContext parameter.

Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show: