I found an interesting tool, so I’ll introduce it. It’s dotPeek. Using this, you can decompile applications created with .NET 1.0 to .NET 4.5 into C# code.

1. Preparation

As preparation, I created the following .NET application. It’s a simple program that just checks if the user input is “momoclo” and displays a message box.

private void button1_Click(object sender, EventArgs e)
{
  // Password
  if (textBox1.Text == "momoclo")
    MessageBox.Show("Success");
  else
    MessageBox.Show("Failure");
}

form1.cs.design

form1.cs

When you open the file, it immediately decompiles and easily returns it to code written in C#. Amazing. Hard-coding passwords is definitely not good. Dangerous.

Reference: Introducing “dotPeek” - A free .NET Decompiler by JetBrains