Last week I started a new series of posts, in which I'll be presenting some of my favorite ReSharper shortcuts. Last time we looked at finding things; this time we'll focus on navigating. Note that I'm using the Visual Studio ReSharper scheme (which is the default); if you're using another setup then the shortcuts will differ. You can change this from the General pane of the ReSharper options dialogue.
Navigating Inheritance
When the cursor is on a type name, hitting Ctrl + End brings up the 'Derived Types' dialogue. From here, you can quickly navigate to any type that inherits the type you invoked it for:
Similarly, Ctrl + Home brings up the 'Base Types' dialogue, which allows you to quickly navigate in the other direction:
If there is only one derived type or one base type, then ReSharper will immediately navigate to it, skipping the dialogue (at least, this is the default behaviour - you can change it from the configuration if you want to). Note that the cursor doesn't have to be on a type declaration for this to work, it works anywhere a type name is found (such as in variable declarations, for instance).
Navigating Member Inheritance
If the cursor is on a member name, then Ctrl + End and Ctrl + Home will instead let you navigate to types which override it, or base types from which it was overridden, respectively:
For member declarations, ReSharper also provides a nice visual hint that the member implements an interface or overrides a base member, in the gutter of the editor:
Here for example, it tells us that the property is an implementation of an interface; notice the green "i" icon (circled in red). If you click the icon, ReSharper will take you to the interface where the property is declared. If the declaration is in a type outside your solution, ReSharper will bring it up in the Object Browser instead (this goes for all navigation shortcuts, incidentally).
Navigating to Usages
If the cursor is on a member name, hitting Shift + Alt + F12 will bring up a dialogue showing all the usages of this member:
Naturally, this list can be quite long. Hitting Shift + Alt + F11 will instead only search for usages within the current file, and instead of showing a list it will highlight the declaration in red and the usages in blue:
The usages remain highlighted until you press Esc.
Navigating to Declarations
If the cursor is on a member name, hitting Ctrl + Shift + F11 will take you to the type that declares this member. If the cursor is on the instance of something, this will take you to the type declaration of this instance.
Navigate from Here to...
Memorizing all these different shortcuts can be a bit daunting to begin with, and its easy to just revert to using the mouse. Don't despair just yet though; all you really need to begin with is to remember Alt + \ (that's a backlash), which will show you what navigation options are available in the current context:
Notice that it also shows the direct shortcut next to each option, which will help you learn them in no time.