Note: an instance of System.Type.
The goal is to get the methods introduced (I don't know the right word) in a type that - not inherited - is not overridden
I want to use .NET Reflection, and I tried the Type.GetMethods()
method. But he returned even inherited and redefined.
I was thinking about filtering after getting all the methods. And I looked at the properties / methods set by the MethodInfo
class. I could not figure out how to get what I wanted.
For example: I have a class, class A { void Foo() { } }
When I call typeof(A).GetMethods()
, I get Foo
along with the methods in System.Object
: Equals
, ToString
, GetType
and GetHashCode
. I want to filter it only to Foo
.
Does anyone know how to do this?
Thanks.
source share