public Expression ReplaceIn(Expression target) { if (target == null) { throw new ArgumentNullException("target"); } var visitor = new ExpressionReplacerVisitor(_replacements); return(visitor.Replace(target)); }
public static Expression ReplaceParameters(this LambdaExpression lambda, params Expression[] replacer) { var original = lambda.Parameters; var len = Math.Min(original.Count, replacer.Length); var result = lambda.Body; for (int i = 0; i < len; i++) { result = new ExpressionReplacerVisitor(original[i], replacer[i]).Visit(result); } return(result); }
public Expression ReplaceIn(Expression target) { if (_target == null) { throw new ArgumentNullException("target"); } var visitor = new ExpressionReplacerVisitor(_replacements); return visitor.Replace(_target); }
public static Expression <Func <T, bool> > Combine <T, TProp>(this Expression <Func <T, TProp> > left, Expression <Func <TProp, bool> > right) { var body = new ExpressionReplacerVisitor(right.Parameters[0], left.Body).Visit(right.Body); return(Expression.Lambda <Func <T, bool> >(body, left.Parameters[0])); }