System.Linq.Expressions.ConditionalExpression.Update C# (CSharp) Méthode

Update() public méthode

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 test, Expression ifTrue, Expression ifFalse ) : ConditionalExpression
test Expression The property of the result.
ifTrue Expression The property of the result.
ifFalse Expression The property of the result.
Résultat ConditionalExpression
        public ConditionalExpression Update(Expression test, Expression ifTrue, Expression ifFalse)
        {
            if (test == Test && ifTrue == IfTrue && ifFalse == IfFalse)
            {
                return this;
            }
            return Expression.Condition(test, ifTrue, ifFalse, Type);
        }
    }

Usage Example

        /// <summary>
        ///     Visits the children of the <see cref="ConditionalExpression" />.
        /// </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 VisitConditional(ConditionalExpression node)
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }

            return(node.Update(Visit(node.Test), Visit(node.IfTrue), Visit(node.IfFalse)));
        }
All Usage Examples Of System.Linq.Expressions.ConditionalExpression::Update