Interface IMarshaller<T, TSurrogate>
- Namespace
- PolyType
- Assembly
- PolyType.dll
Represents a bidirectional mapping between T
and TSurrogate
.
public interface IMarshaller<T, TSurrogate>
Type Parameters
T
The source type.
TSurrogate
The surrogate type.
Remarks
Implementations should form a bijection between T
and TSurrogate
,
meaning that chaining ToSurrogate(T?) with FromSurrogate(TSurrogate?) and vice versa should
always produce equal results.
Methods
FromSurrogate(TSurrogate?)
Maps an instance of TSurrogate
back to T
.
T? FromSurrogate(TSurrogate? surrogate)
Parameters
surrogate
TSurrogateThe input of type
TSurrogate
.
Returns
- T
A value of type
T
corresponding tosurrogate
.
ToSurrogate(T?)
Maps an instance of T
to TSurrogate
.
TSurrogate? ToSurrogate(T? value)
Parameters
value
TThe input of type
T
.
Returns
- TSurrogate
A value of type
TSurrogate
corresponding tovalue
.