Open sandboxFocus

Interface IMethodResultFactory

Chooses how one call site is intercepted: redirected to an existing method, or redirected to a method synthesized from a template. It is the base of IMethodInterceptionSite.

Namespace: Metalama.Extensions.Interceptors
Assembly: Metalama.Extensions.Interceptors.dll
Syntax
[CompileTime]
[InternalImplement]
public interface IMethodResultFactory
Remarks

A result created by this interface is used in the compilation in which it is created, and it is not kept, so its arguments can be any code model value, including the expressions of the call site. IMethodRegistrationFactory is the counterpart of this interface for a result that applies to every call site, which is kept across compilations.

Methods

Name Description
RedirectToExistingMethod(IMethod)

Redirects the calls to an existing method.

RedirectToSynthesizedMethod(in MethodTemplateSelector)

Redirects the calls to a method synthesized from a template given as a MethodTemplateSelector.

RedirectToSynthesizedMethod(TemplateInvocation)

Redirects the calls to a method synthesized from a template given as a TemplateInvocation, which also gives the arguments and the template provider.

RedirectToSynthesizedMethod(string)

Redirects the calls to a method synthesized from the template of the given name.

Extension Methods