views:

864

answers:

4

In Visual Studio, How do I show all classes inherited from a base class?

For example, in ASP.NET MVC there are several 'ActionResult' types -- and they all inherit from / implement the base class 'ActionResult'.

It looks like unless you just 'know' that 'View' and 'Json' are valid 'ActionResult' types, there is no way you can easily find this information out.

Please prove me wrong.

Is there something in the object browser that makes this easy to find out?

I'm even up for suggestions of tools outside of Visual Studio to discover this information about various classes. For example: is there something in Resharper that will help me out?

+9  A: 

Sure, Resharper can do this. And much more.

Just right click on type name in any place and choose "Go To Inheritor" in context menu. "Go To Inheritor" can be also applied to method for navigating to overrides and an interface method's implementations. For an interface you could call "Find Usages Advanced" againd, just right click) where to find all extendings and implementations. For a type - derived types. And my favorite feature - click with holding Control on any type/method for navigating to its declaration.

It's merely must have tool for .net developers.

Shrike
I cannot believe that MS havent put this type of functionality into VS yet...
Mark
+1  A: 

For Framework classes, I use the MSDN Library. The Inheritance Hierarchy section goes in both directions. Admittedly not much help for some 3d party libraries, though.

Tom Juergens
A: 

Looks like one of my friends has already weighed in.

Looks like Resharper can do it, and he IM'd me a web page that describes how (with pictures!):

http://blog.stevehorn.cc/2008/06/resharper-find-implementations.html

Dan Esparza
+1  A: 

You can also use Reflector.

Load all of the assemblies you want it to look in, navigate to a type, and expand the Derived Types item.

You can also do this in the Object Browser, but for some reason VS2008 can only do it in one of the .Net Framework views. (VS2010 Beta 2 can do it in any view)

SLaks