Find code using Go To commands
Visual Studio's Go To commands perform a focused search of your code to help you quickly find specified items. You can go to a specific line, type, symbol, file, and member from a simple, unified interface.
In Visual Studio 2022, a new search experience replaces much of the functionality described here. For example, Go to type or Ctrl+T goes (by default) to the new search experience in Visual Studio 2022, rather than opening the Go to type window. The new search experience is documented at Visual Studio search.
Visual Studio can be configured to use the previous functionality as described in this article. To set this option, you can go to Tools > Options > Environment > Preview Features > New Visual Studio Search experience.
How to use it
|Press Ctrl+T or Ctrl+,
|Select Edit > Go To > Go To All
A small window is displayed at the top right of your code editor.
As you type in the text box, the results appear in a drop-down list below the text box. To go to an element, choose it in the list.
You can also enter a question mark (?) to get additional help.
By default, the specified item is searched for in all solution items. However, you can limit your code search to specific element types by prefacing the search terms with certain characters. You can also quickly change the search filter by choosing buttons on the Go To dialog box toolbar. Buttons that change the type filters are on the left side, and buttons that change the scope of the search are on the right side.
Filter to a specific type of code element
To narrow your search to a specific type of code element, you can either specify a prefix in the search box, or select one of the five filter icons:
|Go to the specified line number
|Go to the specified file
|Go to the specified, recently visited file
|Go to the specified type
|Go to the specified member
|Go to the specified symbol
Filter to a specific location
To narrow your search to a specific location, select one of the two document icons:
|Search current document only
|Search external documents in addition to those located in the project/solution
If you use camel casing in your code, you can find code elements faster by entering only the capital letters of the code element name. For example, if your code has a type called
CredentialViewModel, you can narrow down the search by choosing the Type filter (t) and then entering just the capital letters of the name (
CVM) in the Go To dialog box. This feature can be helpful if your code has long names.
Selecting the gear icon lets you change how this feature works:
|Use preview tab
|Display the selected item immediately in the IDE's preview tab
|Display project, file, line, and summary information from documentation comments in the window
|Move this window to the top-center of the code editor, instead of the top-right