Beispiel #1
0
 /// <summary>
 /// Returns a new expression in which all occurrences of a specified expression
 /// in the input expression are replaced with another specified expression.
 /// </summary>
 /// <param name="expression">The input expression.</param>
 /// <param name="oldValue">The expression to be replaced.</param>
 /// <param name="newValue">The expression to replace all occurrences of <paramref name="oldValue"/>.</param>
 /// <returns></returns>
 public static Expression Replace(this Expression expression, Expression oldValue,
                                  Expression newValue) => ExpressionReplacementVisitor.Replace(expression, oldValue, newValue);
Beispiel #2
0
        public static Expression Replace(Expression expression, Expression oldValue, Expression newValue)
        {
            var visitor = new ExpressionReplacementVisitor(oldValue, newValue);

            return(visitor.Visit(expression));
        }