Hello,
How would I go about joining two lambda expressions like theese:
Expression<Func<string, bool>> expr1 = a => a.Length > 100;
Expression<Func<string, bool>> expr2 = b => b.Length < 200;
... into an expression like this:
Expression<Func<string, bool>> expr3 = s => s.Length < 100 && s.Length < 200;
That is, joining them with an AndAlso operator. (Or any other operator for that matter...)
I actually succeeded with some nasty recursive replacement of lambda parameters and then joining with the Expression.AndAlso method. But I'm looking for something more simple.
For example something like: (Which obviously doesn't work.)
Expression<Func<string, bool>> expr3 = c => expr1(a) && expr2(b);