How to get MethodInfo for Array.IndexOf<string>(string[], string) ?
I try using this code, but doesn’t work.
typeof(Array).GetMethod("IndexOf",
BindingFlags.Public | BindingFlags.Static, null,
new Type[] { typeof(string[]), typeof(string) }, null);
Use
BindingFlags.Public | BindingFlags.StaticEdit:
The comment below is correct, the problem is that the
IndexOfmethod is generic – there is only aArray.IndexOf<T>(T[], T). To get that one this is what worked for me: