ReplaceParameters() public static method

public static ReplaceParameters ( LambdaExpression @in ) : Expression
@in System.Linq.Expressions.LambdaExpression
return System.Linq.Expressions.Expression
        private static Expression <Func <T, bool> > Combine <T>(Expression <Func <T, bool> > head, IEnumerable <Expression <Func <T, bool> > > tail, Func <Expression, Expression, BinaryExpression> combiner)
        {
            var result = tail.Aggregate(head, (soFar, element) =>
            {
                var lambda = LambdaSubstituter.ReplaceParameters(element, soFar.Parameters);
                return((Expression <Func <T, bool> >)Expression.Lambda(combiner(soFar.Body, lambda), soFar.Parameters));
            });

            return(result);
        }
 protected override Expression VisitMethodCall(MethodCallExpression node)
 {
     if (AreTheSameMethod(node.Method, _what.Method))
     {
         if (IsTheSameObject(node.Object, _what.Object))
         {
             return(LambdaSubstituter.ReplaceParameters(_with, node.Arguments));
         }
     }
     return(base.VisitMethodCall(node));
 }
Esempio n. 3
0
 public static Expression Splice(this LambdaExpression e, params Expression[] newExpr)
 {
     return(LambdaSubstituter.ReplaceParameters(e, newExpr));
 }
Esempio n. 4
0
 public static Expression Splice(this LambdaExpression e, IEnumerable <Expression> newExpr)
 {
     return(LambdaSubstituter.ReplaceParameters(e, newExpr));
 }