I am trying to get a MethodInfo object for the method:
Any<TSource>(IEnumerable<TSource>, Func<TSource, Boolean>)
The problem I’m having is working out how you specify the type parameter for the Func<TSource, Boolean> bit…
MethodInfo method = typeof(Enumerable).GetMethod('Any', new[] { typeof(Func<what goes here?, Boolean>) });
Help appreciated.
There’s no way of getting it in a single call, as you would need to make a generic type constructed of the generic parameter of the method (TSource in this case). And as it’s specific to the method, you would need to get the method to get it and build the generic Func type. Chicken and egg issue heh?
What you can do though is to get all the Any methods defined on Enumerable, and iterate over those to get the one you want.