Func<sometype,bool> to Func<T,bool>
- by user175528
If i have:
public static Func<SomeType, bool> GetQuery() {
return a => a.Foo=="Bar";
}
and a generic version
public static Func<T, bool> GetQuery<T>() {
return (Func<T,bool>)GetQuery();
}
how can I do the case?
The only way I have found so far is to try and combine it with a mock function:
Func<T, bool> q=a => true;
return (Func<T, bool>)Delegate.Combine(GetQuery(), q);
I know how to do that with Expression.Lambda, but I need to work with plain functions, not expression trees