I'm working on developing an open source .Net obfuscator, and I had to
find all the methods overriding/overriden by a given method.
As Keith said, you should load all parent types to see which methods
override which ones. However, it's not as simple as it seams. Do not
forget that a signature can change when instantiating generic types :
Class C1<T>
{
virtual void MyMethod(T arg) {}
}
Class C2<T1, T2> : C1<T2>
{
virtual void MyMethod(T2 arg) {}
}
Class C3 : C2 <int, bool>
{
virtual void MyMethod(bool arg) {}
}
C1.MyMethod, C2.MyMethod and C3.MyMethod have distinct signatures, but
you should deals with them as equivalent !
==> Consider also the following case (it can be important for some
applications, as it was the case of my obfuscator)
Class C1
{
virtual void MyMethod() {}
}
Interface I1
{
void MyMethod();
}
Class C2 : C1, I1
{ }
Although C2 implements I1, it doesn't provide directly an
implementation for I1.MyMethod. This is because C2 inherits from C1,
and C1 contains a method MyMethod.
As you can see, C1.MyMethod overrides indirectly I1.MyMethod, but I1
isn't a parent of C1 !
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---