Class DerivedTypeUnion
- Namespace
- Nerdbank.MessagePack
- Assembly
- Nerdbank.MessagePack.dll
A non-generic abstract base class for a type union that is centered on a common base type.
public abstract class DerivedTypeUnion
- Inheritance
-
DerivedTypeUnion
- Derived
-
DerivedShapeMapping<TBase>
- Inherited Members
Remarks
Users should create instances of the derived DerivedShapeMapping<TBase> or DerivedTypeMapping<TBase> classes to define unions at runtime, or use the CreateDisabled(Type) method to disable an attribute-described union.
Properties
BaseType
Gets the base union type.
public abstract Type BaseType { get; }
Property Value
Disabled
Gets a value indicating whether the union behavior is disabled on the BaseType.
public virtual bool Disabled { get; }
Property Value
Remarks
As the default behavior is non-union behavior anyway, this property is primarily useful for forcing the serializer to ignore any and all DerivedTypeShapeAttribute that may be present on the BaseType.
Methods
CreateDisabled(Type)
Creates a DerivedTypeUnion instance that disables a derived type union
that may be discovered from one or more DerivedTypeShapeAttribute that
may be found on the given baseType.
public static DerivedTypeUnion CreateDisabled(Type baseType)
Parameters
baseTypeTypeThe base type to treat as an ordinary class instead of the base of a union.
Returns
- DerivedTypeUnion
The union disabling object.
ThrowIfFrozen()
Throws an InvalidOperationException if this instance has been frozen.
protected void ThrowIfFrozen()