IntroduceDelegate(IAdviser<INamespaceOrNamedType>, string, Action<IDelegateBuilder>, OverrideStrategy)
Introduces a new delegate 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 delegate to a different type or namespace than the current one.
Declaration
public static IIntroductionAdviceResult<INamedType> IntroduceDelegate(this IAdviser<INamespaceOrNamedType> adviser, string name, Action<IDelegateBuilder> buildDelegate, OverrideStrategy whenExists = OverrideStrategy.Default)Parameters
| Type | Name | Description |
|---|---|---|
| IAdviser<INamespaceOrNamedType> | adviser | An adviser for a named type or namespace. |
| string | name | The delegate name. |
| Action<IDelegateBuilder> | buildDelegate | A callback that modifies the IDelegateBuilder that represents the introduced delegate. The signature of the
introduced delegate is given through this callback, 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. |