Update() 공개 메소드

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 operand ) : UnaryExpression
operand Expression The property of the result.
리턴 UnaryExpression
예제 #1
0
        private Expression VisitUnaryExtracted(UnaryExpression node)
        {
            var visited = Visit(node.Operand);
            var updated = node.Update(visited);

            return(ValidateUnary(node, updated));
        }
예제 #2
0
        protected override ExpressionTree VisitUnary(UnaryExpression node)
        {
            CheckChildrenCount(1);

            var o = ExtractChildExpression(0);

            var expression = node.Update(o);

            return(CreateExpressionTree(expression));
        }
예제 #3
0
 /// <summary>
 /// Visits a unary expression that's not a <see cref="ExpressionType.Quote"/> using the specified
 /// assignment behavior. If the node represents an assignment, the <see cref="UnaryExpression.Operand"/>
 /// is visited using <see cref="VisitLval"/>.
 /// </summary>
 /// <param name="node">The unary expression to visit.</param>
 /// <param name="isAssignment">Indicates if the node represents an assignment.</param>
 /// <returns>The result of visiting the unary expression.</returns>
 protected virtual Expression VisitUnaryNonQuote(UnaryExpression node, bool isAssignment)
 {
     if (isAssignment)
     {
         var operand = VisitLval(node.Operand);
         return(node.Update(operand));
     }
     else
     {
         return(base.VisitUnaryNonQuote(node));
     }
 }
 protected override Expression VisitUnary(UnaryExpression node)
 {
     if (node.NodeType == ExpressionType.ArrayLength) {
         Expression expression = this.Visit(node.Operand);
         //translate arraylength into normal member expression
         return Expression.MakeMemberAccess(expression, expression.Type.GetRuntimeProperty("Length"));
     } else if (node.NodeType == ExpressionType.Convert) {
         return this.Visit(node.Operand);
     } else {
         return node.Update(this.Visit(node.Operand));
     }
 }
예제 #5
0
 protected override Expression VisitUnary(UnaryExpression node)
 {
     switch (node.NodeType)
     {
         case ExpressionType.ArrayLength:
             var expression = this.Visit(node.Operand);
             //translate arraylength into normal member expression
             return Expression.MakeMemberAccess(expression, expression.Type.GetRuntimeProperty("Length"));
         case ExpressionType.Convert:
             return this.Visit(node.Operand);
         default:
             return node.Update(this.Visit(node.Operand));
     }
 }
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used 
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        protected override Expression VisitUnary(UnaryExpression node)
        {
            var operand = Visit(node.Operand);

            if (!IsOptimalExpansion)
            {
                return node;
            }

            if (node.NodeType == ExpressionType.Not)
            {
                IsOptimalExpansion = false;
            }

            return node.Update(operand);
        }
예제 #7
0
 /// <summary>
 /// Visits the children of the <see cref="UnaryExpression"/>.
 /// </summary>
 /// <param name="node">The expression to visit.</param>
 /// <returns>The modified expression, if it or any subexpression was modified;
 /// otherwise, returns the original expression.</returns>
 protected internal virtual Expression VisitUnary(UnaryExpression node)
 {
     return(ValidateUnary(node, node.Update(Visit(node.Operand))));
 }
예제 #8
0
 private UnaryExpression replaceUnaryNodeChild(UnaryExpression node, Expression oldChild, Expression newChild)
 {
     return node.Update(newChild);
 }