Tags: , | Posted by Kevin Babcock on 7/10/2009 11:38 PM | Comments (1)

When working in big projects one of my favorite ways to get around is to right-click on a variable, class name, or method call in code and select Go To Definition from the context menu.

Visual Studio context menu

This quickly opens the file where the object you clicked on is defined and navigates to its definition. Very handy when trying to sort through and figure out code you didn’t write. If you’re like me, you often find yourself wandering into the depths of someone else’s code and eventually you’re going to want to back out and get back to where you started. In Visual Studio there are two navigation buttons on the Standard toolbar menu which allow you to move forward and backwards through your navigation history.

Visual Studio navigation buttons

If you select the dropdown menu on the Backward button you can also view and navigate to code you visited in your navigation history. It is organized by filename so you can easily locate the code you want.

Visual Studio navigation history

You can also use the keyboard shortcuts to navigate forward and backward more quickly:

  • Navigate Forward: Ctrl + Shift + -
  • Navigate Backward: Ctrl + -

The shortcuts aren’t as intuitive as I like, so I changed them. You change the keyboard shortcuts bound to the navigation commands as well in Tools | Options | Environment | Keyboard.

Visual Studio keyboard binding options

Enjoy!

kick it on DotNetKicks.com

Comments

John Sheehan on 7/12/2009 2:10 PM F12 is your friend if you love Go To Definition. Also, if your mouse has forward/back buttons on it (and if your mouse doesn't have a back button on it, you should upgrade) those will navigate the code navigation history as well.

Add comment




biuquote
  • Comment
  • Preview
Loading