Class SubtypeMarshaler<TDerived, TBase>
- Namespace
- PolyType.SourceGenModel
- Assembly
- PolyType.dll
Defines an injective marshaler between two types in a subtype relationship.
public sealed class SubtypeMarshaler<TDerived, TBase> : IMarshaler<TDerived, TBase> where TDerived : TBase
Type Parameters
TDerived
The derived type.
TBase
The base type.
- Inheritance
-
SubtypeMarshaler<TDerived, TBase>
- Implements
-
IMarshaler<TDerived, TBase>
- Inherited Members
Properties
Instance
The singleton instance of the subtype marshaler.
public static SubtypeMarshaler<TDerived, TBase> Instance { get; }
Property Value
- SubtypeMarshaler<TDerived, TBase>
Methods
Marshal(TDerived?)
Maps an instance of TSource
to TTarget
.
public TBase? Marshal(TDerived? value)
Parameters
value
TDerivedThe input of type
TSource
.
Returns
- TBase
A value of type
TTarget
corresponding tovalue
.
Unmarshal(TBase?)
Maps an instance of TTarget
back to TSource
.
public TDerived? Unmarshal(TBase? value)
Parameters
value
TBaseThe input of type
TTarget
.
Returns
- TDerived
A value of type
TSource
corresponding tovalue
.