IntroduceEnum(IAdviser<INamespaceOrNamedType>, string, Action<IEnumBuilder>, OverrideStrategy)
Introduces a new enum into the current namespace (as a top-level type) or type (as a nested type). Use the With<TNewDeclaration>(TNewDeclaration) or WithNamespace(IAdviser<ICompilation>, string) method to introduce the enum to a different type or namespace than the current one.
Declaration
public static IIntroductionAdviceResult<INamedType> IntroduceEnum(this IAdviser<INamespaceOrNamedType> adviser, string name, Action<IEnumBuilder> buildEnum, OverrideStrategy whenExists = OverrideStrategy.Default)Parameters
| Type | Name | Description |
|---|---|---|
| IAdviser<INamespaceOrNamedType> | adviser | An adviser for a named type or namespace. |
| string | name | The enum name. |
| Action<IEnumBuilder> | buildEnum | A callback that configures the introduced enum. It must add at least one member, because an enum that declares no member
has no possible value, which is why this parameter is required and precedes |
| OverrideStrategy | whenExists | Determines the implementation strategy when a type of the same name is already declared in the target type or namespace. The default strategy is to fail with a compile-time error. |
Returns
| Type | Description |
|---|---|
| IIntroductionAdviceResult<INamedType> | An IIntroductionAdviceResult<T> that exposes the outcome of the operation and the introduced INamedType. |