var pt = Type.GetType("<Program>$");
var m = pt.GetMethod("<Main>$", BindingFlags.Static);
// m is null
Okay, I grab the Program class, this works fine. But when I go to grab the Main method, system cannot find it, and it's not in pt.GetMembers() either. What's going on?
You just need to specify that you want to see non-public members:
Likewise using
GetMembers, you need to specify you want public and non-public members: