vtable and MSIL
I have to teach the difference between abstract class and interface. It could help me the answer to the following question. Please help me!!! Is it possible to see the content of vtable using ILdasm? I would 开发者_运维技巧like to see an example that show the difference between vtable in case of an abstract class and an interface in IL language.
No, the vtable is built at runtime by the CLR class loader. You can certainly guess at it, it contains pointers to the jitted methods according to the class or interface declaration.
Demonstrating it requires looking at the generated machine code and using the Disassembly and Memory 1 windows. Be sure to either use the Release build or turn Edit + Continue off when you do, it adds an extra layer of indirection.
精彩评论