Validator.ValidateValue Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Validates the specified attributes.
public:
static void ValidateValue(System::Object ^ value, System::ComponentModel::DataAnnotations::ValidationContext ^ validationContext, System::Collections::Generic::IEnumerable<System::ComponentModel::DataAnnotations::ValidationAttribute ^> ^ validationAttributes);
public static void ValidateValue (object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.IEnumerable<System.ComponentModel.DataAnnotations.ValidationAttribute> validationAttributes);
public static void ValidateValue (object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.IEnumerable<System.ComponentModel.DataAnnotations.ValidationAttribute> validationAttributes);
static member ValidateValue : obj * System.ComponentModel.DataAnnotations.ValidationContext * seq<System.ComponentModel.DataAnnotations.ValidationAttribute> -> unit
Public Shared Sub ValidateValue (value As Object, validationContext As ValidationContext, validationAttributes As IEnumerable(Of ValidationAttribute))
Parameters
- value
- Object
The value to validate.
- validationContext
- ValidationContext
The context that describes the object to validate.
- validationAttributes
- IEnumerable<ValidationAttribute>
The validation attributes.
Exceptions
The validationContext
parameter is null
.
The value
parameter does not validate with the validationAttributes
parameter.
Remarks
This method tests each validation attribute in the validationAttributes
parameter against the value
parameter. If a RequiredAttribute attribute is included, the RequiredAttribute attribute is evaluated first.
Applies to
.NET