IntroduceUnion(INamespaceOrNamedType, string, Action<IUnionBuilder>, OverrideStrategy)
Introduces a new union, written with the union keyword, to the target namespace or type.
Declaration
IIntroductionAdviceResult<INamedType> IntroduceUnion(INamespaceOrNamedType targetNamespaceOrType, string name, Action<IUnionBuilder> buildUnion, OverrideStrategy whenExists = OverrideStrategy.Default)Parameters
| Type | Name | Description |
|---|---|---|
| INamespaceOrNamedType | targetNamespaceOrType | The namespace or type into which the union must be introduced. |
| string | name | The name of the introduced union. |
| Action<IUnionBuilder> | buildUnion | A callback that configures the introduced union. It must add at least one case, because the language requires a union to
have one. The parameter is required and precedes |
| OverrideStrategy | whenExists | Determines the implementation strategy when a type of the same name is already declared in the target namespace or type. The default strategy is to fail with a compile-time error. |
Returns
| Type | Description |
|---|---|
| IIntroductionAdviceResult<INamedType> | An IIntroductionAdviceResult<T> representing the result of the advice. The Declaration property provides access to the introduced union. |