I tried googling and searching StackOverFlow, but I'm not seeing an clear answer to this. How can I see the IL code that my C# gets compiled into? I want to compare two methods to see if they produce the same IL. I saw a really great video once of this guy looking at the IL code, but I forget what tools he used to look at it. I seem to remember the one had a tree-view where he could look around at the different objects in memory. I know he wasn't using Visual Studio.

有帮助吗?

解决方案

You can use ILDASM (Intermediate language disassembler).

Other tools like .NET Reflector, dotPeek, JustDecompile or ILSpy can also show the IL code, in addition to showing it in C#, Visual Basic .NET and/or other languages.

LINQPad can also show the IL of your code snippets, but not the IL of arbitrary assemblies.


EDIT: actually dotPeek only shows C# code, not IL

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top