Validator.TryValidateProperty Metódus

Definíció

Ellenőrzi a tulajdonságot.

public:
 static bool TryValidateProperty(System::Object ^ value, System::ComponentModel::DataAnnotations::ValidationContext ^ validationContext, System::Collections::Generic::ICollection<System::ComponentModel::DataAnnotations::ValidationResult ^> ^ validationResults);
public static bool TryValidateProperty(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection<System.ComponentModel.DataAnnotations.ValidationResult> validationResults);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of validationContext.ObjectType cannot be statically discovered.")]
public static bool TryValidateProperty(object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection<System.ComponentModel.DataAnnotations.ValidationResult>? validationResults);
public static bool TryValidateProperty(object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection<System.ComponentModel.DataAnnotations.ValidationResult>? validationResults);
static member TryValidateProperty : obj * System.ComponentModel.DataAnnotations.ValidationContext * System.Collections.Generic.ICollection<System.ComponentModel.DataAnnotations.ValidationResult> -> bool
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of validationContext.ObjectType cannot be statically discovered.")>]
static member TryValidateProperty : obj * System.ComponentModel.DataAnnotations.ValidationContext * System.Collections.Generic.ICollection<System.ComponentModel.DataAnnotations.ValidationResult> -> bool
Public Shared Function TryValidateProperty (value As Object, validationContext As ValidationContext, validationResults As ICollection(Of ValidationResult)) As Boolean

Paraméterek

value
Object

Az érvényesítendő érték.

validationContext
ValidationContext

Az érvényesítendő tulajdonságot leíró környezet.

validationResults
ICollection<ValidationResult>

Egy gyűjtemény, amely az egyes sikertelen érvényesítéseket tárolja.

Válaszok

trueha a tulajdonság érvényesítve van; egyéb esetben. false

Attribútumok

Kivételek

value nem rendelhető hozzá a tulajdonsághoz.

-vagy-

value az null.

A MemberName tulajdonság validationContext nem érvényes tulajdonság.

Megjegyzések

Ez a módszer minden ValidationAttribute olyan példányt tesztel, amely a paraméter által validationContext azonosított tulajdonsághoz van társítva.

A következőre érvényes: