Func<sometype,bool> to Func<T,bool>
Posted
by user175528
on Stack Overflow
See other posts from Stack Overflow
or by user175528
Published on 2010-03-15T18:44:50Z
Indexed on
2010/03/15
18:49 UTC
Read the original article
Hit count: 423
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
© Stack Overflow or respective owner