How to get MethodInfo for generic extension method?
问题 I have an IEnumerable<T> , and I want to call the Enumerable.Contains method by reflection. I'm just struggling to get the syntax right. Here's what I currently have: var containsMethod = typeof(Enumerable).GetMethod("Contains", new[] { typeof(IEnumerable<T>), typeof(T) }); This just comes back with a null. What is the correct way to get the MethodInfo ? 回答1: What is the correct way to get the MethodInfo? You have to find the generic method - which is unfortunately a bit of a pain - and then