Validator.TryValidateObjectAsync Метод
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Перегрузки
TryValidateObjectAsync(Object, ValidationContext, ICollection<ValidationResult>, CancellationToken)
- Исходный код:
- Validator.cs
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")]
public static System.Threading.Tasks.Task<bool> TryValidateObjectAsync(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection<System.ComponentModel.DataAnnotations.ValidationResult>? validationResults, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")>]
static member TryValidateObjectAsync : obj * System.ComponentModel.DataAnnotations.ValidationContext * System.Collections.Generic.ICollection<System.ComponentModel.DataAnnotations.ValidationResult> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Shared Function TryValidateObjectAsync (instance As Object, validationContext As ValidationContext, validationResults As ICollection(Of ValidationResult), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Boolean)
Параметры
- instance
- Object
- validationContext
- ValidationContext
- validationResults
- ICollection<ValidationResult>
- cancellationToken
- CancellationToken
Возвращаемое значение
- Атрибуты
Применяется к
TryValidateObjectAsync(Object, ValidationContext, ICollection<ValidationResult>, Boolean, CancellationToken)
- Исходный код:
- Validator.cs
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")]
public static System.Threading.Tasks.Task<bool> TryValidateObjectAsync(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection<System.ComponentModel.DataAnnotations.ValidationResult>? validationResults, bool validateAllProperties, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")>]
static member TryValidateObjectAsync : obj * System.ComponentModel.DataAnnotations.ValidationContext * System.Collections.Generic.ICollection<System.ComponentModel.DataAnnotations.ValidationResult> * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Shared Function TryValidateObjectAsync (instance As Object, validationContext As ValidationContext, validationResults As ICollection(Of ValidationResult), validateAllProperties As Boolean, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Boolean)
Параметры
- instance
- Object
- validationContext
- ValidationContext
- validationResults
- ICollection<ValidationResult>
- validateAllProperties
- Boolean
- cancellationToken
- CancellationToken
Возвращаемое значение
- Атрибуты