CompareAttribute.IsValid Method

 

Namespace:   System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

NameDescription
System_CAPS_pubmethodIsValid(Object)

(Inherited from ValidationAttribute.)

System_CAPS_protmethodIsValid(Object, ValidationContext)

Determines whether the specified object is equal to the compared object.(Overrides ValidationAttribute.IsValid(Object, ValidationContext).)

Return to top

CompareAttribute.IsValid Method (Object, ValidationContext)

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

protected override ValidationResult IsValid(
	object value,
	ValidationContext validationContext
)

Parameters

value
Type: System.Object

The value of the object to compare.

validationContext
Type: System.ComponentModel.DataAnnotations.ValidationContext

The validation context.

Return Value

Type: System.ComponentModel.DataAnnotations.ValidationResult

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.

Return to top
Show: