How can I view MSIL / CIL generated by C# compiler? Why is it called assembly?

前端 未结 13 997
南方客
南方客 2020-11-28 18:53

I\'m new to .NET C# programming. I\'m following few books. It is said that instead of compiling it directly to binary code (Native code). High level code is converted into i

相关标签:
13条回答
  • 2020-11-28 19:59

    From my experience the best source of IL-related knowledge is Andrew Troelsen “Pro C# and .NET Platform”. Starting from 3rd edition he has really, really outstanding chapter (approx 50 pages) on how to understand IL and even write your own code and use ILAsm. I’ve employed that information to investigate whether multiple inheritance exists in .NET world. Also you could try to employ some very interesting features in IL (e.g. filtering of exceptions which only exists in VB but not in C#).

    I highly recommend to read that chapter.

    Eventually, .NET Reflector is an enterprise standard for investigating IL code of assemblies and Richter's book is definitely "must read" stuff. But from other books like mentioned above you could reveal really useful things :)

    Yes, each assembly in .NET world holds some IL code (alongsite with manifest) which could be viewed thru Reflector or ILDasm. Even more, Reflector could show you C# and VB optimized code. This means that any person could view the source code of an assembly and that's why in commercial products obfuscators are used.

    0 讨论(0)
提交回复
热议问题