Struct TypeMappingContext<TSource>
A lightweight generic container for a source object to map.
public readonly struct TypeMappingContext<TSource>
Type Parameters
TSource
Source 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
TDestination
type.
Type Parameters
TDestination
Desired destination type.
Exceptions
- UndefinedTypeMappingException
When mapping from
TSource
toTDestination
is 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
result
TDestinationout parameter that returns Source mapped to the
TDestination
type if mapping was successful.
Returns
- bool
true when mapping was successful, otherwise false.
Type Parameters
TDestination
Desired destination type.