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