Object State Browser control
Jeff Key
January 3, 2003
Updated January 21, 2003

Oftentimes I find myself writing quick little treeview apps to inspect the state of object graphs.  For quite some time I've wanted to create a generic control that would take any object graph and let me quickly inspect its state but never got around to it.  I had some free time tonight and whipped this up.  I've only tested it on the simple graph below, so please let me know if you run into any problems.  I'm sure I'll be updating it soon.

Notes: 

  • It's lazy-loaded, so you can inspect graphs with circular references.
  • Any collections that implement IList or IDictionary are displayed with the elements' indexes and keys, respectively.
  • Value types and strings show their values inline whereas reference types (if not null) are expandable.
  • Due to the lazy loading, the state of each node is valid only at the time it is expanded. 
  • Again, this is a quickie, so please let me know of any problems.  (I thought others may find it useful, so I put it up while I had the time.)
  • Help file is included.

The only relevant properties:

  • Object:  The object to inspect
  • ShowPrivateMembers:  Display private members
  • ShowDataType:  Show the type of each member
  • BoldMemberTypes:  Bold the members whose types are in this ArrayList.
  • BoldMemberNames:  Bold the members whose names are in the array.

Download

Back to dotnet

Private members and data types showing with members of
type Person or named "Name" bolded:

Private members and data types hidden with members of
type Person or named "Name" bolded: