.NET Reflector Support: How can I decompile the implementation of an entire class or struct?

With .NET Reflector you don’t need to decompile a type method by method. You can do the whole thing at once, although it may not be immediately obvious how.

All you need to do is select the type you want in the assemblies list. If needs be right-click on it and click Disassemble. At this point all you’ll see is the basic definition of the type, but none of the method implementations will have been decompiled. All you need to do now is scroll down to the bottom of the definition, and click the Expand Methods link. And voila! After a few seconds of chewing away Reflector will have decompiled the entire implementation for you.

This process is illustrated in figure 1, and figure 2 shows the result.

DecompileEntireType_Fig1_ExpandMethods_S

Figure 1. I’m decompiling System.Array. Note that I’ve scrolled down to the bottom of the class definition, which includes a number of private types, until the Expand Methods link is in view. All I now need to do is click this link.

DecompileEntireType_Fig2_DoneIt_Small_th

Figure 2. Here’s the result. You can see that .NET Reflector has completely decompiled the entire implementation of the System.Array class, along with its private types.