Språk

Validator Class

Definition

Defines a helper class that can be used to validate objects, properties, and methods when it is included in their associated ValidationAttribute attributes.

public ref class Validator abstract sealed
public static class Validator
type Validator = class
Public Class Validator
Inheritance
Validator

Methods

Name Description
TryValidateObject(Object, ValidationContext, ICollection<ValidationResult>, Boolean)

Determines whether the specified object is valid using the validation context, validation results collection, and a value that specifies whether to validate all properties.

TryValidateObject(Object, ValidationContext, ICollection<ValidationResult>)

Determines whether the specified object is valid using the validation context and validation results collection.

TryValidateObjectAsync(Object, ValidationContext, ICollection<ValidationResult>, Boolean, CancellationToken)

Asynchronously tests whether the given object instance is valid.

TryValidateObjectAsync(Object, ValidationContext, ICollection<ValidationResult>, CancellationToken)

Asynchronously tests whether the given object instance is valid.

TryValidateProperty(Object, ValidationContext, ICollection<ValidationResult>)

Validates the property.

TryValidatePropertyAsync(Object, ValidationContext, ICollection<ValidationResult>, CancellationToken)

Asynchronously tests whether the given property value is valid.

TryValidateValue(Object, ValidationContext, ICollection<ValidationResult>, IEnumerable<ValidationAttribute>)

Returns a value that indicates whether the specified value is valid with the specified attributes.

TryValidateValueAsync(Object, ValidationContext, ICollection<ValidationResult>, IEnumerable<ValidationAttribute>, CancellationToken)

Asynchronously tests whether the given value is valid against a specified list of ValidationAttributes.

ValidateObject(Object, ValidationContext, Boolean)

Determines whether the specified object is valid using the validation context, and a value that specifies whether to validate all properties.

ValidateObject(Object, ValidationContext)

Determines whether the specified object is valid using the validation context.

ValidateObjectAsync(Object, ValidationContext, Boolean, CancellationToken)

Asynchronously throws a ValidationException if the given object instance is not valid.

ValidateObjectAsync(Object, ValidationContext, CancellationToken)

Asynchronously throws a ValidationException if the given instance is not valid.

ValidateProperty(Object, ValidationContext)

Validates the property.

ValidatePropertyAsync(Object, ValidationContext, CancellationToken)

Asynchronously throws a ValidationException if the given property value is not valid.

ValidateValue(Object, ValidationContext, IEnumerable<ValidationAttribute>)

Validates the specified attributes.

ValidateValueAsync(Object, ValidationContext, IEnumerable<ValidationAttribute>, CancellationToken)

Asynchronously throws a ValidationException if the given value is not valid for the ValidationAttributes.

Applies to