Open sandboxFocus

Interface ICaller

Describes the code that contains a site: the member, the kind of code and the function.

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

The object has the lifetime of the object that exposes it. An object exposed by an IInterceptionContext must not be stored after the delegate that received the context returns. An object exposed by Caller is valid during the expansion of the template.

Properties

Name Description
CanAccessThis

Gets a value indicating whether code at the site can reference this. The value is false in static members, static lambdas, static local functions, field initializers, constructor initializers, and lambdas or local functions of struct members.

IsInAsyncFunction

Gets a value indicating whether the innermost enclosing method, local function or lambda is async.

IsInNestedFunction

Gets a value indicating whether the site is inside a lambda, an anonymous method or a local function of the member.

IsInStaticFunction

Gets a value indicating whether a static lambda, anonymous method or local function contains the site. Such a function cannot reference this or the parameters and local variables of the functions that contain it.

Kind

Gets the kind of code that immediately contains the site.

Member

Gets the innermost member of the code model that contains the site: a method, a constructor, an operator or an accessor, the field, property or event of an initializer, the entry point for top-level statements, or the primary constructor for primary-constructor base arguments. Lambdas and local functions are attributed to their enclosing member.

Method

Gets Member as a method: an ordinary method, an operator, an accessor, or the entry point for top-level statements.

Parameters

Gets the parameters of Member when it is a method, a constructor or an indexer. The parameters of a lambda or a local function that contains the site are not included.

Extension Methods