How to view Intermediate Language in C# using Ildasm.Exe

ILDASM (IL Disassembler) and ILASM (IL Assembler) – In this article, we will discuss What is Assembly and How to view Intermediate Language in C# using ildasm.exe.

ldasm.exe (IL Disassembler).NET Framework (current version) The IL Disassembler is a companion tool to the IL Assembler (Ilasm.exe).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.

what is intermediate language in .net framework

When we compile any .NET application the compiler will generate the assembly. Assembly generated will be in the format of .dll or .exe files based on the type of application we create.

  • Console Application and Windows Application will generate .exe file type assembly.
  • ASP.NET, MVC, Class Library etc will generate .dll file type assembly.

These assemblies files consists of Intermediate Language (IL) or Microsoft Intermediate Language (MSIL). The operating system will not understand the MSIL code as it can only understand the native code.

CLR called as Common Language Runtime is responsible for converting the MSIL code into Native Code which is understood  by the operating systems with the help of Just in Time (JIT) Compiler.

How to view Intermediate Language in C# using Ildasm.Exe

InOrder to view the assembly(.dll, .exe) Microsoft has built ILDASM(Intermediate Language DisAssembler) which will come when you install visual studio and .Net framework.

You could go to visual studio command prompt and type ildasm.exe command to open the IL DASM tool or locate the ildasm.exe using the path C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\ildasm.exe. Note the path might vary depending on the location of your windows and visual studio installation.

Hello, World Console Application Example to view intermediate code in C# using ildasm.exe

using System;

namespace HelloWorld
    class Program
        static void Main(string[] args)
            Console.Write("Hello, World!!");
//Output: Hello, World!!

Well, this would be a simple program in C# which outputs the text Hello, World!!. Now let us open the assembly file using ILDASM and see how the code looks in below screenshot.

How To View Intermediate Language In C# Using Ildasm.exe

When you open the Assembly using ILDASM basically it is divided into 2 parts the first one is the MANIFEST and the second part is the actual code.

MANIFEST – Manifest contains the metadata information like (Public Token Key, Assembly Info, Assembly Version etc.)about the code which we have written.

Assembly – The other part is an assembly code itself which consists our application namespace, classes, constructors method names etc which we have coded in the application.

Leave a Reply

Your email address will not be published.

Sign Up for Our Newsletters

Get notified of the best deals on our WordPress themes.

You May Also Like
[Solved] Err_Http2_Protocol_Error

[Solved] err_http2_protocol_error

Table of Contents Hide Solution err_http2_protocol_errorScenario 1: Low Disk SpaceScenario 2: Gzip double compressionScenario 3: Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR after upgrading to VS 2019 16.10.0 (and 16.10.1) The err_http2_protocol_error…
View Post
Convert A List To String In Python

Convert a list to string in Python

Table of Contents Hide Program to convert a list to string in PythonUsing join() methodUsing List ComprehensionIterating using for loopUsing map() method There are various scenarios where you would need…
View Post