public static MethodInfo GetGenericMethod(this Type type, string name, params Type[] parameterTypes) { foreach (MethodInfo method in Enumerable.Where <MethodInfo>((IEnumerable <MethodInfo>)type.GetMethods(), (Func <MethodInfo, bool>)(method => method.Name == name))) { if (TypeExtensions.HasParameters(method, parameterTypes)) { return(method); } } return((MethodInfo)null); }