Introduction

Most of the times when we want to see the disassembled code we will go for the ILDASM tool and give the mapped path of the dll and see the disassembled code in the tool. Now we have an option for that in Visual Studio itself. Let’s see in this article on how to do this step by step.

Steps

Let’s open a console application and make a small application and see how visual studio disassembles the code and shows the output.

Create a console application and place the below code in the main method.

try

{

Console.Write("Please Enter the Year: ");

int year = int.Parse(Console.ReadLine());

if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0))

{

Console.WriteLine("The year {0}, is a Leap Year", year);

}

else

{

Console.WriteLine("The year {0}, is not a Leap Year", year);

}

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

}

Console.ReadLine();

Place a break point at the execution end level to see the disassembled code as shown in the below image

Now run the application by pressing F5 from the keyboard or directly press the arrow button in the IDE to start the execution process. It will run the steps and go to the break point as shown below.

Now right click on the code and u can see the option Go To Disassembly as shown in the below image

Finally it will open a new window where you can see the disassembled code as shown in the below image