You want this:
cl.GetMethods(BindingFlags.DeclaredOnly |
BindingFlags.Instance |
BindingFlags.Public);
Per the MSDN documentation it states that DeclaredOnly
:
Specifies that only members declared at the level of the supplied type's hierarchy should be considered. Inherited members are not considered.
Now, maybe you explicitly want methods that aren't public
:
cl.GetMethods(BindingFlags.DeclaredOnly |
BindingFlags.Instance |
BindingFlags.NonPublic);
If you want both public
and non-public
method, do this:
cl.GetMethods(BindingFlags.DeclaredOnly |
BindingFlags.Instance |
BindingFlags.Public |
BindingFlags.NonPublic);
Notice that each query contains Instance
and Public
or NonPublic
, that's because the documentation states the following:
You must specify Instance or Static along with Public or NonPublic or no members will be returned.