Let's look at how to view IL code using ILDASM tool
How to view C# IL
code using IL DASM tool
We all know C# is platform independent language like
java. And the beauty of platform independent language is it can run anywhere.
Means, if we compile a piece of code in my 32 bit system and try to run in 64
bit operating system it will work smoothly. This is called platform independent.
So, .NET framework does not generate native code
directly when we compile any C# program.
Rather than generating native code .NET framework generates one half
compiled code called intermediate language. And this intermediate language is
taken by JIT (Just in time) compiler to produce native code.
If we want to see intermediate code we can check it
by using ILDASM. Those who are not familiar with IL DASM below few lines are
for them.
IL DASM is a tool provided by Visual Studio to open
IL code. We can find IL DASM tool by going Visual Studio option through all
programs.

How
to use IL DASM to see IL code
At first we have to write program and need to
compile it. After compilation we can open generated exe file in IL DASM tool
and we can view half compiled code. In below I am showing steps.
1) Write
program in C#
I have written a simple program to show IL code.
Here is my C# code.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
namespace Test1
{
class Program
{
static void Main(string[] args)
{
Console.Write("Hello world");
Console.ReadLine();
}
}
}
2) Compile
and debug it by pressing F5 key.
3) Open
IL DASM tool and select exe file by going to proper file location of your
current program.

4) Open
.exe file using IL DASM

5) Double
click on Main() function

conclusion :
Those are steps to view IL code using IL DASM tool. Hope this is helpful.