ValidateCollectionItemsAttribute Class
Validates each item in a collection by running validation on each item.
[AttributeUsage(AttributeTargets.Property)]
[RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")]
public sealed class ValidateCollectionItemsAttribute : ValidationAttributeExample
public sealed class MyModel
{
// Validates each item using the data annotations of ChildModel
[ValidateCollectionItems]
public List<ChildModel>? Items { get; set; }
}
public sealed class ChildModel
{
[Required]
public string? Name { get; set; }
}- Inheritance
ValidationAttributeValidateCollectionItemsAttribute
Constructors
| Name | Description |
|---|---|
| ValidateCollectionItemsAttribute() |
ValidateCollectionItemsAttribute()
public ValidateCollectionItemsAttribute()No documentation is available.
Methods
| Name | Description |
|---|---|
| IsValid(object?) |