Interface IUnionTypeAliasProvider
- Namespace
- Nerdbank.MessagePack
- Assembly
- Nerdbank.MessagePack.dll
Supplies custom identifiers for cases of C# unions.
public interface IUnionTypeAliasProvider
Remarks
Implementations must be thread-safe and return consistent results for the lifetime of a serializer that uses them. Aliases are resolved while constructing converters, not for each serialized value. A custom identifier forces a discriminator wrapper, including for otherwise untagged primitive and collection cases.
Methods
GetAlias(IUnionTypeShape, IUnionCaseShape)
Gets a custom identifier for a union case.
DerivedTypeIdentifier? GetAlias(IUnionTypeShape unionShape, IUnionCaseShape caseShape)
Parameters
unionShapeIUnionTypeShapeThe shape of the containing union.
caseShapeIUnionCaseShapeA case belonging to
unionShape.
Returns
- DerivedTypeIdentifier?
The custom identifier, or null to use the case's normal encoding, which may omit a discriminator.