Using the Validation Block Validators

Microsoft Enterprise Library 5.0

DropDown image DropDownHover image Collapse image Expand image CollapseAll image ExpandAll image Copy image CopyHover image

The Validation Application Block includes classes named validators, which derive from the Validator class. There is a generic version of this class named Validator<T>.

Every validator is associated with a specific type. For example, the StringLengthValidator class checks to see if a System.String value has a length within a predefined range.

There are four ways that you can associate validators with your types:

You can also instantiate validators within your code without associating them with a specific type. For more information, see Creating Validators Programmatically.

The following sections describe the validator types that are included with the Validation Application Block. These validators are the following:

Each entry contains examples for how to use the validator with attributes and with code.