Open sandboxFocus

Interface IMethodInterceptionContext

Describes one use of a method that a method registration selects: a call, or a method group converted to a delegate, added to or removed from an event, or converted to a function pointer.

Namespace: Metalama.Extensions.Interceptors
Assembly: Metalama.Extensions.Interceptors.dll
Syntax
[CompileTime]
[InternalImplement]
public interface IMethodInterceptionContext : IInterceptionContext

Properties

Name Description
Arguments

Gets one element for each parameter of InterceptedMethod, in parameter order, including parameters that receive default values. The list is empty for a method-reference site, because the arguments are passed when the delegate or the function pointer is invoked.

DispatchKind

Gets how the call dispatches to the intercepted method.

InterceptedMethod

Gets the method to which the C# compiler binds the call, or that the method-group conversion selects, constructed with the type arguments of the site. A classic extension method called in reduced form is represented in its static form, and its receiver is the first element of Arguments. Its definition, without the type arguments of the site, is Definition.

IsResultUsed

Gets a value indicating whether the value returned by the call is used. It is always false for a method-reference site, because the value is used by the code that invokes the delegate.

MatchedMethod

Gets the method definition that the registration matched by its declaring type and its name. It differs from the definition of InterceptedMethod when the site is bound to an override or to an interface implementation, which the registration matches by default and with IncludingInterfaceImplementations().

Receiver

Gets the receiver written at the site.

UseKind

Gets the kind of use at the site. Every registration receives every kind. A delegate given to ForEachSite(Func<IMethodInterceptionSite, IMethodInterception>) that does not support a kind returns Skip().

Extension Methods