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
TDerivedThe derived type.
TBaseThe 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
valueTDerivedThe input of type
TSource.
Returns
- TBase
A value of type
TTargetcorresponding tovalue.
Unmarshal(TBase?)
Maps an instance of TTarget back to TSource.
public TDerived? Unmarshal(TBase? value)
Parameters
valueTBaseThe input of type
TTarget.
Returns
- TDerived
A value of type
TSourcecorresponding tovalue.