MetalamaAPI documentationAspect APIMetalama.​Framework.​Code.​Syntax­BuildersExpression­FactoryCapture
Open sandboxFocus

ExpressionFactory.Capture Method

Capture(Object)

Creates a compile-time object that represents a run-time expression, i.e. the syntax or code, and not the result itself. The returned IExpression can then be used in run-time C# code thanks to the Value property. This mechanism allows to generate expressions that depend on a compile-time control flow.

Declaration
public static IExpression Capture(dynamic expression)
Parameters
Type Name Description
System.Object expression

A run-time expression, possibly containing compile-time sub-expressions. The expression cannot be dynamic. If you have a dynamic expression, do not call this method, but cast the dynamic expression to IExpression.

Returns
Type Description
IExpression
See Also