BlackWaspTM

This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

Visual Studio
VS 2003+

Visual Studio Go To Definition Command

As the size of an application or library's code base grows, it can become difficult to quickly navigate to the definitions that you wish to see. This problem is removed entirely by Visual Studio with the use of the Go To Definition command.

Go To Definition

The Go To Definition command can be used to quickly navigate to the definition of a class, struct, method, property or various other types of declaration in your code. When you are unsure of the exact inner workings of such an item, you can position the text cursor within a reference to that definition, execute the command and immediately see the declaration and its associated code.

An easy way to use the command is to right-click the name of a class or method within the code editor. This displays a context-sensitive menu. You can use this menu to select the Go To Definition option. Alternatively, you can press the F12 key.

Visual Studio Go To Definition Menu

Once you are satisfied with reading the code, you will generally wish to return to your original location. This can be achieved using the navigate backwards command, accessed by pressing Ctrl and -. This key combination can be pressed more than once to continue jumping to previous locations. You can also navigate forwards by pressing Ctrl-Shift and -.

When you attempt to jump to a definition that does not exist within the current solution, an error may be displayed or the available metadata may be used to generate a read-only file containing sample declarations. This varies according to the version of Visual Studio in use.

8 December 2008