.NET Reflector Support: How do I view decompiled source code?

You can view the decompilation output for both types and members in .NET Reflector.

To view a decompilation for a type, right-click on the type in the explorer treeview, and click Disassemble. This is shown in fig. 1, with the resultant decompiler output in fig.2.


Figure 1. Generating a decompilation skeleton for a type. Here we are looking at System.Collections.Hashtable.


Figure 2. Result of decompiling the System.Collections.Hashtable class to C#.

It’s also possible to decompile methods in the same way. As before, right-click on the method and then click on Disassemble. This process is illustrated by figures 3 and 4.


Figure 3. Decompiling a method. Here we are looking at the ContainsValue() method in System.Collections.Hashtable.


Figure 4. Decompiled ContainsValue() method on System.Collections.Hashtable showing C# output.

The examples here have all illustrated C# output, however you can choose other languages for decompiler output using the language drop-down on the toolbar (fig. 5). In figure 6 you can see the ContainsValue() method decompiled to VB.


Figure 5. Using the language drop-down to choose a different decompilation language.


Figure 6. Decompiled ContainsValue() method on System.Collections.Hashtable showing VB output.

Additional language support add-ins are also available:

If you want to decompile and export source code for an entire assembly, please see the following post: