This topic has not yet been rated - Rate this topic

Validator Class

Provides members to help validate objects and members using values from the associated ValidationAttribute attribute.

System.Object
  System.ComponentModel.DataAnnotations.Validator

Namespace:  System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)
public static class Validator

The Validator type exposes the following members.

  Name Description
Public method Static member TryValidateObject(Object, ValidationContext, ICollection<ValidationResult>) Determines whether the specified object is valid.
Public method Static member TryValidateObject(Object, ValidationContext, ICollection<ValidationResult>, Boolean) Determines whether the specified object is valid and, if requested, validates all of the properties of the object.
Public method Static member TryValidateProperty Determines whether the specified property value is valid.
Public method Static member TryValidateValue Determines whether a specified value is valid against a collection of validation attributes.
Public method Static member ValidateObject(Object, ValidationContext) Determines whether the specified object is valid and throws a ValidationException if the object is not valid.
Public method Static member ValidateObject(Object, ValidationContext, Boolean) Determines whether the specified object is valid and, if requested, whether all of the properties on the object are valid, and throws a ValidationException if the object is not valid.
Public method Static member ValidateProperty Determines whether the specified property value is valid and throws a ValidationException if the property is not valid.
Public method Static member ValidateValue Determines whether a specified value is valid against a collection of validation attributes and throws a ValidationException if the value is not valid.
Top

Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ