Interface IMarshaler<TSource, TTarget>
- Namespace
- PolyType
- Assembly
- PolyType.dll
Represents a bidirectional mapping between TSource
and TTarget
.
public interface IMarshaler<TSource, TTarget>
Type Parameters
TSource
The source type from which we're marshaling.
TTarget
The target type to which we're marshaling.
Remarks
Implementations should form a bijection between TSource
and TTarget
,
meaning that chaining Marshal(TSource?) with Unmarshal(TTarget?) and vice versa should
always produce equal results.
Methods
Marshal(TSource?)
Maps an instance of TSource
to TTarget
.
TTarget? Marshal(TSource? value)
Parameters
value
TSourceThe input of type
TSource
.
Returns
- TTarget
A value of type
TTarget
corresponding tovalue
.
Unmarshal(TTarget?)
Maps an instance of TTarget
back to TSource
.
TSource? Unmarshal(TTarget? value)
Parameters
value
TTargetThe input of type
TTarget
.
Returns
- TSource
A value of type
TSource
corresponding tovalue
.