Open sandboxFocus

Interface IInvocationReceiver

Describes the receiver written at a site: the object on which the method is called or from which the method group is taken.

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

The object has the lifetime of the IMethodInterceptionContext that exposes it, so it must not be stored after the delegate that received the context returns.

Properties

Name Description
Expression

Gets the receiver expression written at the site, for inspection only, or null when the intercepted method is static or the receiver is implicit. For a classic extension method called in reduced form, the receiver is the first element of Arguments, and this property is null. For a conditional access a?.M(), it is the expression a. For a method-reference site obj.M, it is obj, which C# evaluates when the delegate is created.

IsConditionalAccess

Gets a value indicating whether the call is written with the null-conditional operator ?.. It is always false for a method-reference site.

Kind

Gets the kind of receiver written at the site.

Type

Gets the static type of the receiver, or null when Kind is None.

Extension Methods