Table of Contents

Interface IUnionTypeShape

Namespace
PolyType.Abstractions
Assembly
PolyType.dll

Provides a discriminated union shape model for a .NET type.

public interface IUnionTypeShape : ITypeShape
Inherited Members

Remarks

Supports type hierarchies configured using DerivedTypeShapeAttribute or InferClosedTypePolymorphism, F# discriminated unions, and types implementing the C# union member pattern.

Properties

BaseType

Gets the underlying type shape of the union base type.

ITypeShape BaseType { get; }

Property Value

ITypeShape

Remarks

Type hierarchies use this shape as a fallback for values not matching a registered case. F# and C# unions expose an empty object shape without a constructor.

UnionCases

Gets the list of all registered union case shapes.

IReadOnlyList<IUnionCaseShape> UnionCases { get; }

Property Value

IReadOnlyList<IUnionCaseShape>

UnionKind

Gets the union representation described by this shape.

UnionTypeShapeKind UnionKind { get; }

Property Value

UnionTypeShapeKind

Remarks

Returns Unknown when the representation is not specified, including shapes produced by older source generators.