static private NoMethodOnTypeMatchingArguments ( string name, object type ) : Exception | ||
name | string | |
type | object | |
return | Exception |
private static MethodInfo FindMethod(Type type, string name, ReadOnlyCollection <Expression> args, Type[] typeArgs) { using (IEnumerator <MethodInfo> en = type.GetStaticMethods().Where(m => m.Name == name).GetEnumerator()) { if (!en.MoveNext()) { throw Error.NoMethodOnType(name, type); } do { MethodInfo mi = en.Current; if (ArgsMatch(mi, args, typeArgs)) { return((typeArgs != null) ? mi.MakeGenericMethod(typeArgs) : mi); } } while (en.MoveNext()); } throw Error.NoMethodOnTypeMatchingArguments(name, type); }
internal static MethodInfo FindMethod(Type type, string name, ReadOnlyCollection <Expression> args, Type[] typeArgs, BindingFlags flags) { MethodInfo[] methods = type.GetMethods(flags).Where(m => m.Name == name).ToArray(); if (methods.Length == 0) { throw Error.NoMethodOnType(name, type); } MethodInfo mi = methods.FirstOrDefault(m => ArgsMatch(m, args, typeArgs)); if (mi == null) { throw Error.NoMethodOnTypeMatchingArguments(name, type); } if (typeArgs != null) { return(mi.MakeGenericMethod(typeArgs)); } return(mi); }