CompareAttribute.IsValid(Object, ValidationContext) Method

Definition

Determines whether the specified object is equal to the compared object.

protected override System.ComponentModel.DataAnnotations.ValidationResult IsValid (object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext);
override this.IsValid : obj * System.ComponentModel.DataAnnotations.ValidationContext -> System.ComponentModel.DataAnnotations.ValidationResult
Protected Overrides Function IsValid (value As Object, validationContext As ValidationContext) As ValidationResult

Parameters

value
Object

The value of the object to compare.

validationContext
ValidationContext

The validation context.

Returns

null if the value of the compared property is equal to the value parameter; otherwise, a validation result that contains the error message that indicates that the comparison failed.

Applies to