About the author

Steven HarmanSteven Harman is a passionate developer who believes that writing great software isn't just a job, its a craft.

ASP.NET MVP

For recent posts and more about me, scroll to the bottom.

Subscribe

  • Subscribe to my feed. via RSS
  • Subscribe via email via email

Jobs

Badges

  • Subtext Project
  • Support Subtext
  • HiddenNetwork.com Banner

ReSharper - Show Type Hierarchy

I realize that this post may make it seem like I'm playing a game of Keeping-Up-with-the-Jones', but I promise it only seems that way. In truth the explanation is that great minds think alike. Just kidding... half kidding anyhow.

OK, so I do have a real bit of news (at least to me) to report. First I must admit that I am a slave to keyboard shortcuts - especially when combined with the ReSharper Visual Studio Add-in - so this news is probably only a big deal to me. But that's why this is MY blog, and not yours, so deal with it!

Get To It Already!

The shortcut I'm talking about here deals with using ReSharper's Show Type Hierarchy functionality. This functionality allows you to view the inheritance hierarchy of a given Type in a dedicated window. The window shows both base Types and inheritors of the selected Type and allows you to navigate to any of them with a quick mouse click.

One place this is especially useful is when you want to quickly know what classes extend an abstract base class. To do this, open the abstract base in VS and place your cursor in the middle (or there about) of the class name. Then click CTRL+ALT+H. This will open the ReSharper Type Hierarchy View for the class. The result will look similar to the following:

ReSharper - Type Hierarchy View

As you can see, I was in the DbProvider class when we hit the shortcut keys. The resulting window shows the full hierarchy of the class, from the original base class Object to the last child class, SqlDataProvider. You'll also notice that the view is synced up with the editor in that the highlighted Type is the one we used the shortcut from. All I have to do at this point is double-click any one of the listed Types and VS will open it. Simple, quick, and effective - what's not to like!

A Bonus Shortcut... or Two

I realize that was pretty anticlimactic... so let me try to make up for it by throwing in another ReSharper shortcut just for good measure. You can quickly see all of the base Types and even base methods of a Type or method, respectively, by putting your cursor on the class name or method and hitting CTRL+U.

ReSharper - View Base Type

In the above example, I was in the SqlDataProvider class, working in the GetPreviousNext method and I wanted to know exactly what this code was overriding. So by hitting CTRL+U, I was able to quickly jump right to the base method. Also, if you instead of jumping to the base, you would rather jump to an inheritor of a Type or method, hit CTRL+ALT+B.

These are two very simple shortcuts I know, but they will no doubt improve your productivity... I know they have improved mine!

What others are saying.

# ReSharper - Show Type Hierarchy
Gravatar DotNetKicks.com
Jul 27, 2006
You've been kicked (a good thing) - Trackback from DotNetKicks.com 
# re: ReSharper - Show Type Hierarchy
Gravatar James Hebben
Jul 28, 2006
I love ReSharper, but did not know about CTRL+ALT+H. Cool.

Take a look at these also:

I love ReSharper
http://extraview.co.uk/blog/PermaLink,guid,572721a1-5acc-4c7c-85a0-d9430056c479.aspx

ReSharper blog
http://blogs.jetbrains.com/dotnet/
# re: ReSharper - Show Type Hierarchy
Gravatar Steve Harman
Jul 28, 2006
James,
Thanks for the links, I'll be sure to check them out!
Comments have been closed on this topic.