How does one use Type.GetMethod() to get a method with lambda parameters? I'm trying to get the Queryable.Any method for a parameter of something like Func, using this:
typeof(Queryable).GetMethod("Any", new Type[]{typeof(Func<ObjType, bool>)})
but it keeps returning null.
There are four things wrong:
Queryable.Any
- theIQueryable<T>
Func<ObjType, bool>
which is a delegate type, instead ofExpression<Func<ObjType, bool>>
which is an expression tree typeYou want:
That should get you the relevant
Any
method. It's not clear what you're then going to do with it.