Validator.ValidateObject Validator.ValidateObject Validator.ValidateObject Method

Definition

Determines whether the specified object is valid.

Overloads

ValidateObject(Object, ValidationContext) ValidateObject(Object, ValidationContext) ValidateObject(Object, ValidationContext)

Determines whether the specified object is valid using the validation context.

ValidateObject(Object, ValidationContext, Boolean) ValidateObject(Object, ValidationContext, Boolean) ValidateObject(Object, ValidationContext, Boolean)

Determines whether the specified object is valid using the validation context, and a value that specifies whether to validate all properties.

ValidateObject(Object, ValidationContext) ValidateObject(Object, ValidationContext) ValidateObject(Object, ValidationContext)

Determines whether the specified object is valid using the validation context.

public:
 static void ValidateObject(System::Object ^ instance, System::ComponentModel::DataAnnotations::ValidationContext ^ validationContext);
public static void ValidateObject (object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext);
static member ValidateObject : obj * System.ComponentModel.DataAnnotations.ValidationContext -> unit

Parameters

instance
Object Object Object

The object to validate.

validationContext
ValidationContext ValidationContext ValidationContext

The context that describes the object to validate.

Exceptions

instance doesn't match the ObjectInstance on validationContext.

Remarks

This method evaluates each ValidationAttribute instance that is attached to the object type.

ValidateObject(Object, ValidationContext, Boolean) ValidateObject(Object, ValidationContext, Boolean) ValidateObject(Object, ValidationContext, Boolean)

Determines whether the specified object is valid using the validation context, and a value that specifies whether to validate all properties.

public:
 static void ValidateObject(System::Object ^ instance, System::ComponentModel::DataAnnotations::ValidationContext ^ validationContext, bool validateAllProperties);
public static void ValidateObject (object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, bool validateAllProperties);
static member ValidateObject : obj * System.ComponentModel.DataAnnotations.ValidationContext * bool -> unit

Parameters

instance
Object Object Object

The object to validate.

validationContext
ValidationContext ValidationContext ValidationContext

The context that describes the object to validate.

validateAllProperties
Boolean Boolean Boolean

true to validate all properties; otherwise, false.

Exceptions

instance doesn't match the ObjectInstance on validationContext.

Remarks

This method evaluates each ValidationAttribute instance that is attached to the object type.

Applies to