Validator.TryValidateProperty 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 property.
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);
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
Public Shared Function TryValidateProperty (value As Object, validationContext As ValidationContext, validationResults As ICollection(Of ValidationResult)) As Boolean
Parameters
- value
- Object
The value to validate.
- validationContext
- ValidationContext
The context that describes the property to validate.
- validationResults
- ICollection<ValidationResult>
A collection to hold each failed validation.
Returns
true
if the property validates; otherwise, false
.
Exceptions
The MemberName property of validationContext
is not a valid property.
Remarks
This method tests each ValidationAttribute instance that is associated with the property that is identified by the validationContext
parameter.
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET