CollectionModelBinder<TElement> Class

Definition

IModelBinder implementation for binding collection values.

C#
public class CollectionModelBinder<TElement> : Microsoft.AspNetCore.Mvc.ModelBinding.ICollectionModelBinder, Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder

Type Parameters

TElement

Type of elements in the collection.

Inheritance
CollectionModelBinder<TElement>
Derived
Implements

Constructors

Properties

ElementBinder

Gets the IModelBinder instances for binding collection elements.

Logger

The ILogger used for logging in this binder.

Methods

AddErrorIfBindingRequired(ModelBindingContext)

Add a ModelError to ModelState if IsBindingRequired.

BindModelAsync(ModelBindingContext)

Attempts to bind a model.

CanCreateInstance(Type)

Gets an indication whether or not this ICollectionModelBinder implementation can create an Object assignable to targetType.

ConvertToCollectionType(Type, IEnumerable<TElement>)

Gets an Object assignable to targetType that contains members from collection.

CopyToModel(Object, IEnumerable<TElement>)

Adds values from sourceCollection to given target.

CreateEmptyCollection(Type)

Create an Object assignable to targetType.

CreateInstance(Type)

Create an instance of targetType.

Applies to

Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0