Open sandboxFocus

Method This

This(INamedType)

Gets a this expression for the given type.

Declaration
public static IExpression This(INamedType type)
Parameters
Type Name Description
INamedType type

A type.

Returns
Type Description
IExpression
Remarks

Unlike meta.This and the parameterless This() method, the current method works in any context, even outside a template.

See Also

This()

Gets a this expression for the type of this that the current context defines.

Declaration
public static IExpression This()
Returns
Type Description
IExpression
Remarks

In a template, the type is the declaring type of the target declaration, given by meta.Target.Type. A context that executes user code outside of a template can define another type, for instance the type that contains a call site.

Exceptions
Type Condition
InvalidOperationException

The current context defines no type of this.

See Also