I need to pass a parameter to a method that requires an Expression<Func<T, bool>>
.
How to do I pass an expression that would always return true
?
Using obj => true
doesn't work because the framework complains at runtime that it cannot determine the memeber type from the True constant.
If you have a function like this
void TakeExpression<T>(Expression<Func<T, bool>> expr)
You should call it this way, specifying the T type :
TakeExpression<int>(_ => true)
It should work.