Open sandboxFocus

Method UseExpression

UseExpression(IExpression)

Creates a pull strategy that passes a static expression value to the introduced parameter.

Declaration
public static IPullStrategy UseExpression(IExpression expression)
Parameters
Type Name Description
IExpression expression

An expression that evaluates to the value to pass. Only static expressions are supported, such as TypedConstant, static field/property access, or static method calls created via ExpressionFactory. To forward an existing parameter, pass an IParameter directly.

Returns
Type Description
IPullStrategy

A pull strategy that uses the specified expression to provide the parameter value.

Remarks

This strategy is useful when you want to pass a static or compile-time expression to the introduced parameter.

Note: While you can pass an IParameter directly to this method to forward a parameter value, it's generally clearer to let IntroduceParameterAndPull(string?, IType?, IExpression?) handle parameter forwarding when appropriate.

See Also