Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ FindMethod()

static MethodInfo System.Linq.EnumerableRewriter.FindMethod ( Type type,
string name,
ReadOnlyCollection< Expression > args,
Type[] typeArgs )
inlinestaticprivate

Definition at line 269 of file EnumerableRewriter.cs.

270 {
271 using (IEnumerator<MethodInfo> enumerator = (from m in type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
272 where m.Name == name
273 select m).GetEnumerator())
274 {
275 if (!enumerator.MoveNext())
276 {
277 throw Error.NoMethodOnType(name, type);
278 }
279 do
280 {
281 MethodInfo current = enumerator.Current;
282 if (ArgsMatch(current, args, typeArgs))
283 {
284 return (typeArgs != null) ? current.MakeGenericMethod(typeArgs) : current;
285 }
286 }
287 while (enumerator.MoveNext());
288 }
289 throw Error.NoMethodOnTypeMatchingArguments(name, type);
290 }
static bool ArgsMatch(MethodInfo m, ReadOnlyCollection< Expression > args, Type[] typeArgs)
virtual MethodInfo MakeGenericMethod(params Type[] typeArguments)
Definition MethodInfo.cs:41

References System.Linq.EnumerableRewriter.ArgsMatch(), System.Reflection.MethodInfo.MakeGenericMethod(), System.Linq.Error.NoMethodOnType(), System.Linq.Error.NoMethodOnTypeMatchingArguments(), and System.type.

Referenced by System.Linq.EnumerableRewriter.VisitMethodCall().