Few years ago, Lutz Roeder has developed an assembly decompiler that was very popular. So much popular that Red Gate Software has bought the software and since than it’s not anymore free.
Good news, a free open source alternative exist. This alternative is ILSpy.
This tool let you select an assembly and it will decompile it. This can also work with Microsoft Framework assembly. To select one of the .Net Framework, you need to load the desired DLL of from : C:\Windows\Microsoft.NET\Framework\v4.0.30319 for .Net 4 framework DLL.
For framework 2.0, the location is : C:\Windows\Microsoft.NET\Framework\v2.0.50727. It’s also possible to get 64 bits version of the code. 64 bits .Net DLL are located to the directory C:\Windows\Microsoft.NET\Framework64\.
Last thing, this tool let you also see the IL code. IL Disassembly mean Intermediary Language. It’s also known as MSIL for MicroSoft Intermediary Language. Seeing the IL is interesting to see how the C# compiler has produce code that will be read by the Virtual Machine later. This is a good way to optimized query by comparing the produced code.
For your personal information, Microsoft .Net Framework come with a tool called : Ildasm.exe. This tool can be used as a command line or with its graphical interface.