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

前端 未结 13 1056
南方客
南方客 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:55

    One of my favorite ways to see IL for a snippet of C# is to use the free LINQPad tool. After entering some code and choosing "C# statements" at the top (or "C# Program", whichever suits), click the "IL" button under the code entry area, and you will see the generated IL.

    Using LINQPad for this is much more convenient than loading up Visual Studio or running the compiler from the command line, then loading up ILDASM and opening the .il file with a text editor.

提交回复
热议问题