共用方式為


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

適用於