Microsoft Silverlight will reach end of support after October 2021. Learn more.
Provides information about a type or member to validate.
Assembly: System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)
'Declaration Public NotInheritable Class ValidationContext _ Implements IServiceProvider
public sealed class ValidationContext : IServiceProvider
The ValidationContext type exposes the following members.
|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.|
|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.|
|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.)|
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.
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.