I’m a big fan of developer tools. In fact, without the right tools our lives as software developers would be much more frustrating and less productive. So I’d like to start a weekly series of posts in which I’ll provide give a tip or two on how to get the most out of our development tools. Most of the tools I plan to feature are tools that I use for my own development, but if you’d like me to cover a specific tool then by all means send me your suggestions.
This week I want to give a quick overview of what I consider to the most important tool (besides Visual Studio) a .NET developer could ever add to his/her arsenal, .NET Reflector. Originally created by Lutz Roeder, Reflector is now in the care of Red Gate Software, who will handle all its future development. This handy tool lets you explore, browse, and analyze any .NET assembly in the language of your choice. That means you can crack open and peek inside any .NET Framework assembly to see how a particular class or method is implemented, as well as any of your own assemblies. Reflector is a standalone executable, meaning no installation is necessary. To get started, head to the web site and download a copy.
When you first launch Reflector, you’ll be asked to select a default version of any .NET Framework components installed on your machine. In the image below, you can see that I have .NET Framework v2.0 – v3.5, .NET Compact Framework v2.0 – v3.5, and Silverlight 2.0.

Once you select a Framework version, all of its assemblies will be listed in an easily navigable tree. Expand each assembly to browse its contents. Each assembly organizes its content by namespace, class, then class members in alphabetical order.

To view the contents of a particular class, right-click on the class and select Disassemble from the context menu. Alternatively, you can select Tools | Disassemble from the menu.

The disassembled class will be displayed in a new section to the right of the assembly tree. By default, all methods are minimized, but you can easily expand them by clicking on a the method you want to view or selecting the Expand Methods link at the bottom of the window.

You can also navigate through classes and properties by selecting them in the disassembler window. To navigate back and forward to previous selections, simply use the navigation buttons beneath the main menu. If you’d like to view the disassembled class in another language, select the language dropdown list and select your language of choice. Five options are available: MSIL, C#, VB, Delphi, MC++, and Chrome.

If you can’t find the assembly, class, or class member you are after by using the assembly browser, you can search for content by clicking on the magnifying glass below the menu and typing the name of the member in the search box. A list of matches will be displayed in the window below as you type. Simply select the item you want to navigate to it in the assembly browser.

If you want to browse your own or third-party assemblies, you can do so by selecting File | Open from the menu and navigating to the folder where the assembly resides. Once you have opened the assembly, you can browse, search, or disassemble it just like you would any Framework assembly. In the example below, I’ve opened up the latest version of Telerik’s RadControls for ASP.NET AJAX.

Finally, a cool feature of .NET Reflector is that it remembers your settings. If you open your own assemblies or customize any options and then close out of Reflector, those changes will not be lost when you re-launch the tool.
Conclusion
.Net Reflector is an invaluable tool for developers wanting to dive into and learn about the intricacies of the .NET Framework, or any other .NET assembly. Give it a try if you’re not using it already, and stay tuned next week as I go into some more advanced features of this great developer tool.