Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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.

  NameDescription
Public methodStatic memberTryValidateObject(Object, ValidationContext, ICollection<ValidationResult>)Determines whether the specified object is valid.
Public methodStatic memberTryValidateObject(Object, ValidationContext, ICollection<ValidationResult>, Boolean)Determines whether the specified object is valid and, if requested, validates all of the properties of the object.
Public methodStatic memberTryValidatePropertyDetermines whether the specified property value is valid.
Public methodStatic memberTryValidateValueDetermines whether a specified value is valid against a collection of validation attributes.
Public methodStatic memberValidateObject(Object, ValidationContext)Determines whether the specified object is valid and throws a ValidationException if the object is not valid.
Public methodStatic memberValidateObject(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 methodStatic memberValidatePropertyDetermines whether the specified property value is valid and throws a ValidationException if the property is not valid.
Public methodStatic memberValidateValueDetermines 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.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft