In .NET, can you use reflection to get all non-inherited methods of a class?

While calling GetMembers() method to get the members of the Type, you can specify DeclaredOnly in binding flag.


You have to select all members in MySubClass and keep only those where DeclaringType == MySubClass.

With LINQ, something like that (overkill) :

MemberInfo[] notInherited = GetType("MySubClass").GetMembers().Where(m => m.DeclaringType == GetType("MySubClass"));

Or with GetMembers() overload :

MemberInfo[] notInherited = GetType("MySubClass").GetMembers(BindingFlags.DeclaredOnly);