You can use the Ildasm.exe (IL Disassembler) to view Microsoft intermediate language (MSIL) information in a file. If the file being examined is an assembly, this information can include the assembly's attributes and references to other modules and assemblies.
Ildasm.exe takes a portable executable (PE) file that contains intermediate language (IL) code and creates a text file suitable as input to Ilasm.exe. This tool is automatically installed with Visual Studio. To run the tool, use Visual Studio Developer Command Prompt or Visual Studio Developer PowerShell.
Managed code is code that's written in a managed language (C#, VB.NET, F# and many others) that's compiled into CIL (Common Intermediate Language, formerly Microsoft Intermediate Language or MSIL) and run in the managed environment of CLR.
.text
section of the PE file (portable executable = *.exe or *.dll). More information can be found here.If I may recommend a good book on that matter too, it's Expert .NET 2.0 IL Assembler by Serge Lidin. He's the guy who designed MSIL.
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.
If you want it online, .NET Fiddle is excellent. Just paste your code and click View IL
option at the top right.
Another option: Use ReSharper
Source / IL synced view: left blue background line corresponds with right IL Block
In Visual Studio:
Supports synced view of Source Code and IL - when you click on a statement in source, the corresponding block in IL is highlighted (and vice versa). Displays descriptions for IL from Microsoft Developer Network and "Common Intermediate Language (CIL) instruction set" from ECMA standard specification.
see Viewing Intermediate Language (IL) in Resharper Help. Picture above is from Resharper Help.
Free option is to use Jetbrains dotPeek
see also: "Exploring Intermediate Language (IL) with ReSharper and dotPeek", by Maarten Balliauw, January 19, 2017 - Jetbrains Blog
I believe that they are called "assemblies" because an assembly is a set of modules, assembled together by a manifest.
(source: microsoft.com)
See Assembly Contents for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With