Open sandboxFocus

Interface IUnionBuilder

Allows to complete the construction of a union that has been created by the IntroduceUnion(IAdviser<INamespaceOrNamedType>, string, Action<IUnionBuilder>, OverrideStrategy) advice.

Namespace: Metalama.Framework.Code.DeclarationBuilders
Assembly: Metalama.Framework.dll
Syntax
[InternalImplement]
public interface IUnionBuilder : INamedTypeBuilder, IMemberOrNamedTypeBuilder, IDeclarationBuilder, INamedType, IType, IEquatable<IType>, IGeneric, IMemberOrNamedType, INamespaceOrNamedType, INamedDeclaration, IDeclaration, IDisplayable, IDiagnosticLocation, ICompilationElement, IMeasurable, IEquatable<IDeclaration>, IEquatable<INamedType>
Remarks

The union is written with the union keyword. The language applies the restrictions on the members of a union to that form, so an instance field, an automatic property and a field-like event may not be introduced into it.

A union requires at least one case, so an advice whose callback adds none reports an error.

The members that the compiler synthesizes for a union, which are one constructor per case and the Value property, are not set through this interface. They are created by the advice and are read through Facets on the introduced type.

Properties

Name Description
Cases

Gets the case types that have been added so far, in the order in which they were added.

Methods

Name Description
AddCase(IType)

Adds a case to the union.

AddCase(Type)

Adds a case to the union.

Extension Methods

See Also