System.Reflection.Type contains GetInterfaceMap which help to determine what method implement some method from interface.
Does Mono.Cecil contain something like this? Or how to implement such behaviour?
System.Reflection.Type contains GetInterfaceMap which help to determine what method implement some method from interface.
Does Mono.Cecil contain something like this? Or how to implement such behaviour?
Copyright © 2021 Jogjafile Inc.
No, Cecil does not provide such method, because Cecil gives us just CIL metadata as they are. (There is project Cecil.Rocks, which contains some useful extension methods, but not this one)
In MSIL methods have an attribute 'overrides', which contains references to methods that this method overrides (in Cecil there is indeed a property Overrides in the MethodDefinition class). However, this attribute is used only in some special cases such as explicit interface implementation. Usually this attribute is left empty and which methods are overridden by the method in question is based on conventions. These conventions are described in ECMA CIL standard. In short a method overrides methods that have the same name and the same signature.
The following pieces of code might help you as well as this discussion: http://groups.google.com/group/mono-cecil/browse_thread/thread/b3c04f25c2b5bb4f/c9577543ae8bc40a