Class CSharpUnionDataModel
Describes a type following the C# union member pattern.
public sealed class CSharpUnionDataModel : TypeDataModel
- Inheritance
-
CSharpUnionDataModel
- Inherited Members
Properties
Kind
Determines the type of TypeDataModel being used.
public override TypeDataKind Kind { get; }
Property Value
UnionCases
Gets the creation members and their case types in declaration-context compiler enumeration order.
public required ImmutableArray<UnionCaseDataModel> UnionCases { get; init; }
Property Value
Remarks
Distinct creation members are retained even when generic substitution gives them the same case type. Inherited factory hiding is resolved in the original union declaration's generic context. This order is independent of the order needed to match overlapping case types.
UnionMemberProvider
Gets the nested IUnionMembers interface, or null when constructors define the cases.
public INamedTypeSymbol? UnionMemberProvider { get; init; }
Property Value
ValueProperty
Gets the instance property used to access the union payload, either on the union type or its member provider interface.
public required IPropertySymbol ValueProperty { get; init; }