ValidationContext Class
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Provides information about a type or member to validate.
Inheritance Hierarchy
System.Object
System.ComponentModel.DataAnnotations.ValidationContext
Namespace: System.ComponentModel.DataAnnotations
Assembly: System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)
Syntax
'Declaration
Public NotInheritable Class ValidationContext _
Implements IServiceProvider
public sealed class ValidationContext : IServiceProvider
The ValidationContext type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ValidationContext(Object) | Initializes a new instance of the ValidationContext class with the specified object to validate. | |
ValidationContext(Object, IDictionary<Object, Object>) | Initializes a new instance of the ValidationContext class with the specified object to validate and a collection of values related to validation. | |
ValidationContext(Object, IServiceProvider, IDictionary<Object, Object>) | Initializes a new instance of the ValidationContext class with the specified object to validate, a service provider that enables validation methods to access external services, and a collection of values related to validation. |
Top
Properties
Name | Description | |
---|---|---|
DisplayName | Gets or sets the name to display to users for the member to validate. | |
Items | Gets the collection of values associated with the validation request. | |
MemberName | Gets or sets the programmatic name of the member to validate. | |
ObjectInstance | Gets the object to validate. | |
ObjectType | Gets the type of the object to validate. |
Top
Methods
Name | Description | |
---|---|---|
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetService | Retrieves an instance of the service to use during validation. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
InitializeServiceProvider | Initializes the ValidationContext with a service provider that can return service instances of the specified type when the GetService method is called. | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Remarks
The ValidationContext class describes the type or member on which validation is performed. It also enables validation routines to reference services that are available through the GetService method of the IServiceProvider interface.
Version Information
Silverlight
Supported in: 5, 4, 3
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also