I have the following class tree:
public class A
{
public static object GetMe(SomeOtherClass something)
{
return something.Foo();
}
}
pub
You should use one the overloads taking a BindingFlags
parameter, and include FlattenHierarchy
.
Specifies that public and protected static members up the hierarchy should be returned. Private static members in inherited classes are not returned. Static members include fields, methods, events, and properties. Nested types are not returned.
(Edited to remove the point about private static methods, now the question has been changed to make them public.)