Update() public method

Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression.
public Update ( Expression expression, IEnumerable arguments ) : InvocationExpression
expression Expression The property of the result.
arguments IEnumerable The property of the result.
return InvocationExpression
Ejemplo n.º 1
0
        /// <summary>
        /// Visits an invocation expression and visits <see cref="InvocationExpression.Arguments"/> that are passed
        /// to <c>ref</c> or <c>out</c> parameters using <see cref="VisitLval"/>.
        /// </summary>
        /// <param name="node">The invocation expression to visit.</param>
        /// <returns>The result of visiting the invocation expression.</returns>
        protected virtual Expression VisitInvocationCore(InvocationExpression node)
        {
            var expression = Visit(node.Expression);

            var parameters = GetInvokeMethod(expression).GetParameters();

            var arguments = VisitArguments(node.Arguments, parameters);

            return(node.Update(expression, arguments));
        }
Ejemplo n.º 2
0
        protected override ExpressionTree VisitInvocation(InvocationExpression node)
        {
            CheckChildrenCount(1 + node.Arguments.Count);

            var e = ExtractChildExpression(0);
            var a = ExtractChildExpressions(1, node.Arguments.Count);

            var expression = node.Update(e, a);

            return(CreateExpressionTree(expression));
        }
Ejemplo n.º 3
0
        private static InvocationExpression Update(InvocationExpression node)
        {
            // Tests the call of Update to Expression.Invoke factories.

            var res = node.Update(node.Expression, node.Arguments.ToArray());

            Assert.NotSame(node, res);

            return res;
        }