views:

203

answers:

1

Is there any way (perhaps via add-in) that anyone knows to easily list or visualize the fields (and auto-properties) of a class in Visual Studio 2008 SP1 (standalone or with ReSharper 4.5)?

I have been used to seeing fields of a class identified by the blue box/diamond icon in the Members dropdown in the Navigation bar of C# code text editor in Visual Studio 2008. I find it helpful to tell what state the class "owns" in fields and approximately what size an instance of the class is.

Automatically implemented properties have an anonymous field backing them, but they don't have a separate icon in the members dropdown to indicate they have storage behind them.

A: 

I don't know a way of making this distinction within the Visual Studio environment, but the ILDASM utility (MSIL Disassembler) does show you all of the fields within a class, including backing fields for auto-properties.

You can run ILDASM.exe from the VS2008 command line, then open your compiled assembly.

There's a tip here for how to invoke ILDASM from within Visual Studio, but I haven't tried it myself... http://www.devx.com/vb2themax/Tip/18784

In a similar vein, you can get the same information from the excellent (and free!) .Net Reflector from Red Gate.

Julian Martin
Thanks. I have been using Reflector. Perhaps I'll see how well Reflector Pro integrates with Visual Studio to see if there is a fast and easy way to view the class in Reflector from Visual Studio.
Ross Bradbury