Example #1
0
        Expression ConvertExpressionToTemporaryVariable(Expression methodInvocation, Block block)
        {
            var temporaryVariable = new ReferenceExpression(Context.GetUniqueName("with"));

            var assignment = new WithBinaryExpression {
                Operator = BinaryOperatorType.Assign,
                Left     = Expression.Lift(temporaryVariable),
                Right    = methodInvocation
            };

            block.Insert(0, assignment);

            return(temporaryVariable);
        }
Example #2
0
        Expression ConvertExpressionToTemporaryVariable(Expression methodInvocation, Block block)
        {
            var temporaryVariable = new ReferenceExpression(Context.GetUniqueName("with"));

            var assignment = new WithBinaryExpression {
                Operator = BinaryOperatorType.Assign,
                Left = Expression.Lift(temporaryVariable),
                Right = methodInvocation
            };

            block.Insert(0, assignment);

            return temporaryVariable;
        }