Edit

Kongsi melalui


ValidationAttribute.GetValidationResult(Object, ValidationContext) Method

Definition

Checks whether the specified value is valid with respect to the current validation attribute.

public:
 System::ComponentModel::DataAnnotations::ValidationResult ^ GetValidationResult(System::Object ^ value, System::ComponentModel::DataAnnotations::ValidationContext ^ validationContext);
public System.ComponentModel.DataAnnotations.ValidationResult GetValidationResult (object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext);
public System.ComponentModel.DataAnnotations.ValidationResult? GetValidationResult (object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext);
member this.GetValidationResult : obj * System.ComponentModel.DataAnnotations.ValidationContext -> System.ComponentModel.DataAnnotations.ValidationResult
Public Function GetValidationResult (value As Object, validationContext As ValidationContext) As ValidationResult

Parameters

value
Object

The value to validate.

validationContext
ValidationContext

The context information about the validation operation.

Returns

An instance of the ValidationResult class.

Exceptions

The current attribute is malformed.

validationContext is null.

IsValid(Object, ValidationContext) has not been implemented by a derived class.

Remarks

The GetValidationResult method checks validity without throwing an exception.

Applies to

See also