Ildecompilator --ildasm.exeand reflector.exe:
I. Introduction to ildasm.exe
This is a soft vstool, which has been described in detail in the article "ildasm.exe -- il decompilation utility;
Ii. reflector.exe
So far (10.02.03), the latest version downloaded from the http://www.aisto.com/roeder/dotnet is latest version: 5.1.6.0, here also the classic "Hello world. "Example: When reflector is used. when ext opens an executable file, the main interface is as follows:
Reflect.exeis more powerful than ildasm.exe. It can decompile Il, C #, Visual Basic, Delphi, MC ++, and even chrome, and its interface is more friendly. Therefore, it is named as an in-depth IlBest weapon!
Let's take a look at the decompiled IlCodeWhat is it like? What is the same as ildasm.exe? The figure is as follows:
After comparison, you can obtain reflector.exewith a more convenient interface (without many identifiers in ildasm.exe, see the previous blogMsdn help Diagram).
Of course, the reason why reflector.exe is called in-depth IlThe best tool is becauseIt can decompile the Il language and the C # language! In this way, we:It is possible thatSource codeIn the caseProgramSet !!!As shown in the figure above, we find that the source code is fully compiled and correct, which is surprising, and its role must be far-reaching!
Reveal the essence of interfaces with IL:
I. essence of interfaces
Let's first look at a common interface definition:
The IL code decompiled with reflector.exe is:
Visible InterfaceEssentially, CompiledAbstract classThe methods in the interface are compiledAbstract Method(Abstract virtual), there is no implementation body.
Ii. Abstract implementation principle of interfaces
First, let's look at the example of the most basic class inheritance interface, such:
The corresponding ilcode is compiled with reflector.exe:
In this way, we can see that the corresponding interface functions in this class are implemented here."Overwrite" -- override!Therefore, the abstract mechanism of interfaces adoptsPolymorphism!
In summary, I learned more about the reflect.exe instance application and the Il decompilation tool. At the same time, the Il code is used to reveal the essence of the interface and realize that it is keeping the interfaceUniqueness(I will not discuss it here .) Abstract class implementation mechanism and its polymorphism.