I have a predicate Expression<Func<T1, bool>>
I need to use it as a predicate Expression<Func<T2, bool>> using the T1 property of T2 I was trying to think about several approches, probably using Expression.Invoke but couln;t get my head around it.
For reference:
class T2 {
public T1 T1;
}
And
Expression<Func<T1, bool>> ConvertPredicates(Expression<Func<T2, bool>> predicate) {
//what to do here...
}
Thanks a lot in advance.
Try to find the solution with normal lambdas before you think about expression trees.
You have a predicate
and want a predicate
You can build this as an expression tree as follows: