What is ILDASM in .NET?

ILDASM stands for Intermediate Language Disassembler.

ILDASM is a tool provided in C# to view and read the assembly content in manifest view. This tool is supplied along with the Visual Studio .NET you are using. It is also available along with .NET SDK. To access this tool, you have to run the ildasm.exe available in C:\Program Files\Microsoft.NET\SDK\<Framework Version>\bin.

For more clarity, consider a simple example and see how the assembly content related to the example can be viewed. The example is mentioned below:

using System;
using System.Collections.Generic;
using System.Text;
namespace Application1 {
class sampleClass {
static void Main(string[] args) {
Console.WriteLine("Testing ILDASM");

Follow the steps given below to execute ILDASM and view the corresponding results:

Step 1: Compile this program using the statement: csc sampleClass.cs and execute it. Now an executable called Application1.exe is created in the corresponding bin directory of your project.

Step 2: Run ILDASM.exe from the path mentioned in the beginning of this article.

Step 3: The executable opens with a blank window. In the menu, click on File ' Open and choose Application1.exe from the corresponding path. You will get the following window:

Step 4: Expand Application1 to see Application1.sampleClass, the class which you have created. Expand Application1.sampleClass node further and you can see your Main method along with the default members of the class. The expanded tree view is shown below:

Step 5: On click of any drilled down nodes, you can view the Assembly code corresponding to it: Given below are the screenshots showing assembly code of all three nodes one after the other. Note that the Main method you have coded has its assembly code in a format that is tough to interpret and relate with the original source code that you have created.

Equivalent Code for Application1.sampleClass:

Code for .ctor method which is automatically added when you create your class:

Equivalent Code for your Main Method:

| How do you prevent a class from overriding in .NET? | How are classes related to objects in .NET Application | How are Delegates different from Events in .NET? | How are system exceptions different from application exceptions in .NET? | How are Value Types different from Reference Types in .NET? | How can a finalize method be suppressed in .NET? | How can you call Stored Procedure in ADO.NET? | How can you force Dispose method to be called automatically in .NET? | How do you call a Base Class Constructor from Derived Class Constructor in .NET? | How do you connect your VB.NET application to SQL Server? | How do you implement Cloning in .NET? | How do you implement Façade Design Pattern in .NET? | How do you implement MVC Pattern in ASP.NET? | How do you install .NET Assembly in GAC? | How is shadowing different from overriding in .NET? | How to prevent a particular .NET DLL from being decompiled? | Illustrate Delay Signing Process of an Assembly in .NET? | What are Reference Types in .NET? | What are the advantages of C#? | What are the advantages of VB.NET? | What are the differences between Namespace and Assembly in .NET? | What are the similar features between class and structure in .NET? | What are Value Types in .NET? | What do you mean by mixed mode authentication in .NET? | What do you mean by Satellite Assembly in .NET? | What do you mean by shadowing in .NET? | What is CTS in .NET? | What is ILDASM in .NET? | What is Managed Code in .NET? | What is Manifest in .NET? | What is MSIL in .NET Framework? | What is the importance of finalize method in .NET? | What is the need for Visitor Pattern in C#? | What is the purpose of bindingRedirect tag in web.config file of .NET? | What is the purpose of CodeDom in .NET? | What is the purpose of dispose method in .NET? | What is the purpose of Ngen.exe in .NET? | What is the purpose of Strong Name in COM Components of .NET? | What is the purpose of virtual keyword in .NET? | What Object Oriented Principles can be incorporated in .NET Application? |