There is nothing buggy here, tested too many times. You flag
BindingFlags.Static | BindingFlags.Public
means getting all methods of the type (in you case, matching specified
simple name) which are static and public at the same time. This method can really return null. If it happens, it means that no methods meet these criteria. Check it up.
Note the following
- In your code sample, you ignore (throw out) result returned by the method;
- Names are case-sensitive.
Good luck,
—SA