Share via


CompareAttribute.IsValid Method (Object, ValidationContext)

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

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

Syntax

'Declaration
Protected Overrides Function IsValid ( _
    value As Object, _
    validationContext As ValidationContext _
) As ValidationResult
'Usage
Dim value As Object
Dim validationContext As ValidationContext
Dim returnValue As ValidationResult

returnValue = Me.IsValid(value, validationContext)
protected override ValidationResult IsValid(
    Object value,
    ValidationContext validationContext
)
protected:
virtual ValidationResult^ IsValid(
    Object^ value, 
    ValidationContext^ validationContext
) override
protected override function IsValid(
    value : Object, 
    validationContext : ValidationContext
) : ValidationResult

Parameters

Return Value

Type: System.ComponentModel.DataAnnotations.ValidationResult
null reference (Nothing in Visual Basic) 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.

See Also

Reference

CompareAttribute Class

IsValid Overload

System.Web.Mvc Namespace