Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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)

'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)

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
Nothing 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.
Show:
© 2015 Microsoft