Tool to Show Class Hierarchies in .NET

10,579

Solution 1

I second Marc's recommendation of .NET Reflector - and would like to add that there is an impressive series of add-in available at CodePlex.

Just a few of the add-ins I use with regularity:

  • Deblector - This add-in allows to debug processes from within Reflector.
  • Graph - This add-in draws assembly dependency graphs and IL graphs.
  • DependencyStructureMatrix - Allows you to create and browse dependency structure matrices.
  • AutoDiagrammer - This add-in draws class diagrams.
  • CodeModelViewer - This add-in shows the underlying code model objects for selected items.

Solution 2

The Resharper visual studio plugin also has a View Type Hierarchy feature along with its many other great features.

Solution 3

You can use the Object Browser inside Visual Studio:

The Object Browser lets you select and examine the symbols available for use in projects. You can open the Object Browser from the View menu, or by clicking the Object Browser button on the main toolbar.

In the Objects pane, icons identify hierarchical structures such as .NET Framework and COM components, namespaces, type libraries, interfaces, enums, and classes. You can expand these structures to reveal ordered lists of their members. Properties, methods, events, variables, constants, and other contained items are listed in the Members pane. Details on the item selected in the Objects pane or Members pane appear in the Description pane.

Solution 4

Reflector will do this (and is free). Find the interface, and expand the "Derived Types" node in the tree.

Alternatively, the "Class Diagram" project item in Visual Studio should do it, but I like the clean nature of Reflector.

Solution 5

I found this Resharper function handy to show only type hierarchy. Something close to what eclipse offers (F4 - Open type hierarchy) Select parent class then Right click on VS editor and select 'find usages advanced' and select 'derived types' checkbox (or) hit CTRL + ALT + SHIFT F12 to show search properties window

enter image description here

Share:
10,579
Hosam Aly
Author by

Hosam Aly

I'm interested in developing top quality software, optimizing performance, refactoring code, and learning about core computer science topics. For more information about me, please check my LinkedIn profile. I'm currently available for contracts, preferably using Scala or Ruby (outside finance, media, fashion, and advertising).

Updated on June 17, 2022

Comments

  • Hosam Aly
    Hosam Aly about 2 years

    Is there a way/tool that could show me all the classes/interfaces that implement a certain interface in my project? In Eclipse (Java) I would use the context menu "Open Type Hierarchy" option, which would show me a (pretty) tree of types that extend the selected type. Is there a tool to do the same in .NET?

  • Marc Gravell
    Marc Gravell over 15 years
    To get started, use File->Open... and open your project dll(s)
  • Marc Gravell
    Marc Gravell over 15 years
    But not sub-types / implementing-types
  • Hosam Aly
    Hosam Aly over 15 years
    Resharper certainly looks like a good tool, but it's not free. I come from a Java background, so I'm used to getting all the nice goodies for free. :D
  • Mike Two
    Mike Two over 15 years
    That's true. I also come from a Java background, and I found that some of the nicer goodies in Java aren't free either. I always preferred the IntelliJ IDE to Eclipse. Sometimes you get what you pay for. Resharper saves me so much time it is worth the money.
  • Hosam Aly
    Hosam Aly over 15 years
    Reflector did exactly what I needed. Thanks. By the way, the Class Diagram Editor wouldn't have worked for me, because I wanted to check all derived types of a system class.
  • jnnnnn
    jnnnnn almost 13 years
    Implementing types can be found using popup->Find All References.
  • Iman
    Iman almost 12 years
    thanks, RightClick -> Inspect ->Type Hierarchy or Ctrl+E, Ctrl+H
  • Steve Chambers
    Steve Chambers about 11 years
    A deficiency here is the "Find All References" method doesn't work when the class is part of the .Net language. E.g. right now I'd like to find a class that implements System.Web.Routing.RouteBase. Am aware I can go into Internet land to find that out but it would be nice if it were possible within Visual Studio - preferably without having to use a third party tool.
  • Steve Chambers
    Steve Chambers about 11 years
    Reflector may have been free at the time this was written but doesn't look like it is now.
  • ekkis
    ekkis almost 11 years
    just a note that .NET Reflector is not open source. it's now owned by RedGate and costs $