Struct TypeMappingManyContext<TSource>
A lightweight generic container for a source collection of objects to map.
public readonly struct TypeMappingManyContext<TSource>
Type Parameters
TSourceSource collection's element type.
- Inherited Members
Properties
Source
Source collection of objects to map.
public IEnumerable<TSource> Source { get; }
Property Value
- IEnumerable<TSource>
TypeMapper
Attached ITypeMapper instance.
public ITypeMapper TypeMapper { get; }
Property Value
Methods
To<TDestination>()
Maps the Source collection to a collection with elements of the desired TDestination type
using the attached TypeMapper instance.
[Pure]
public IEnumerable<TDestination> To<TDestination>()
Returns
- IEnumerable<TDestination>
Source collection mapped to collection with elements of the
TDestinationtype.
Type Parameters
TDestinationDesired destination collection's element type.
Exceptions
- UndefinedTypeMappingException
When mapping from
TSourcetoTDestinationis not defined.
TryTo<TDestination>(out IEnumerable<TDestination>)
Attempts to map the Source collection to a collection with elements
of the desired TDestination type using the attached TypeMapper instance.
public bool TryTo<TDestination>(out IEnumerable<TDestination> result)
Parameters
resultIEnumerable<TDestination>out parameter that returns Source collection mapped to collection with elements of the
TDestinationtype if mapping was successful.
Returns
- bool
true when mapping was successful, otherwise false.
Type Parameters
TDestinationDesired destination collection's element type.