Class DerivedTypeShapeAttribute
- Namespace
- PolyType
- Assembly
- PolyType.dll
Specifies a known union case to be included in the type hierarchy of the current type.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
public class DerivedTypeShapeAttribute : Attribute
- Inheritance
-
DerivedTypeShapeAttribute
- Inherited Members
Constructors
DerivedTypeShapeAttribute(Type)
Initializes a new instance of the DerivedTypeShapeAttribute class.
public DerivedTypeShapeAttribute(Type type)
Parameters
type
TypeThe derived type associated with the current union case.
Properties
Name
Gets a unique string identifier for the current union case.
public string Name { get; init; }
Property Value
Remarks
Defaults to the name of the derived type if left unspecified.
Tag
Gets a unique numeric identifier for the current union case.
public int Tag { get; init; }
Property Value
Remarks
Used when serializing unions types in compact formats that require numeric identifiers.
Defaults to the order in which the union case was declared if left unspecified or set to a negative value.
Certain runtimes such as mono do not preserve ordering attribute declarations when using reflection. It is recommended that such use cases either set the property explicitly or use the source generator instead.
Type
Gets the derived type associated with the current union case.
public Type Type { get; }