CompareAttribute.IsValid(Object, ValidationContext) 方法

定义

确定指定的对象是否有效。

protected:
 override System::ComponentModel::DataAnnotations::ValidationResult ^ IsValid(System::Object ^ value, System::ComponentModel::DataAnnotations::ValidationContext ^ validationContext);
protected override System.ComponentModel.DataAnnotations.ValidationResult IsValid (object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext);
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

参数

value
Object

要验证的对象。

validationContext
ValidationContext

一个对象,该对象包含有关验证请求的信息。

返回

如果 value 有效,则为 true;否则为 false

适用于