CollectionModelBinder<TElement> Class

Summary

[Microsoft.AspNet.Mvc.ModelBinding.IModelBinder]() implementation for binding collection values.

Inheritance Hierarchy

  • System.Object
  • Microsoft.AspNet.Mvc.ModelBinding.CollectionModelBinder<TElement>

Syntax

public class CollectionModelBinder<TElement> : IModelBinder

GitHub

View on GitHub

Microsoft.AspNet.Mvc.ModelBinding.CollectionModelBinder<TElement>

Methods

BindModelAsync(Microsoft.AspNet.Mvc.ModelBinding.ModelBindingContext)
Arguments:
Return type:

System.Threading.Tasks.Task{Microsoft.AspNet.Mvc.ModelBinding.ModelBindingResult}

public virtual Task<ModelBindingResult> BindModelAsync(ModelBindingContext bindingContext)
CopyToModel(System.Object, System.Collections.Generic.IEnumerable<TElement>)

Adds values from <paramref name=”sourceCollection” /> to given <paramref name=”target” />.

Arguments:
  • target (System.Object) – [System.Object]() into which values are copied.
  • sourceCollection (System.Collections.Generic.IEnumerable{{TElement}}) – Collection of values retrieved from value providers. Or <c>null</c> if nothing was bound.
protected virtual void CopyToModel(object target, IEnumerable<TElement> sourceCollection)
Microsoft.AspNet.Mvc.ModelBinding.CollectionModelBinder<TElement>.CreateEmptyCollection()
Return type:System.Object
protected virtual object CreateEmptyCollection()
GetModel(System.Collections.Generic.IEnumerable<TElement>)

Gets an [System.Object]() assignable to the collection property.

Arguments:
  • newCollection (System.Collections.Generic.IEnumerable{{TElement}}) – Collection of values retrieved from value providers. Or <c>null</c> if nothing was bound.
Return type:

System.Object

Returns:

[System.Object]() assignable to the collection property. Or <c>null</c> if nothing was bound.

protected virtual object GetModel(IEnumerable<TElement> newCollection)