public static IEnumerable <MethodBase> FilterMethods(MethodFilter filter, MethodInfo[] allMethods) { List <MethodBase> methodBases = new List <MethodBase>(); CallingConventions reflectionCallingConvention = SignatureUtil.GetReflectionCallingConvention(filter.CallingConvention); MethodInfo[] methodInfoArray = allMethods; for (int i = 0; i < (int)methodInfoArray.Length; i++) { MethodInfo methodInfo = methodInfoArray[i]; if (methodInfo.Name.Equals(filter.Name, StringComparison.Ordinal) && SignatureUtil.IsCallingConventionMatch(methodInfo, reflectionCallingConvention) && SignatureUtil.IsGenericParametersCountMatch(methodInfo, filter.GenericParameterCount) && (int)methodInfo.GetParameters().Length == filter.ParameterCount) { methodBases.Add(methodInfo); } } return(methodBases); }