Go to Declaration
This command allows you to navigate to the declaration of a symbol from any symbol usage. You can invoke this command from the editor, from the File Structure window and other tool windows.
To navigate in the opposite direction (symbol usages) you can invoke the Go to Declaration command when you are already on the symbol declaration, or you can use the Go to Usages of Symbol command.
If you navigate from a usage of a method or a property, which is declared in an interface, the command will get you not to the interface itself, but to the exact implementation that is used.
To navigate to a declaration of a symbol
- Place the caret on a symbol in the editor or select the symbol in a tool window.
- Choose in the main menu, press Ctrl+B, or click the symbol holding the Ctrl key.
- If the symbol has only one declaration, ReSharper will navigate to it directly.
- If the symbol several declarations (e.g. it is a partial class), they are listed in the drop-down list. Do one of the following:
If the item you navigate to belongs to the current solution, ReSharper opens the corresponding file in the editor and places the caret at the symbol declaration. If it is found in referenced libraries, ReSharper navigates according to the settings defined on the page of ReSharper options.
As Go to Declaration is one of the most frequently used commands, ReSharper streamlines your navigation experience allowing you to use this command in navigation scenarios related to usages of the declared symbol:
You can invoke the Go to Declaration command when your caret is already at a symbol declaration. In this case, ReSharper will show a short version of the Navigate To menu only including the command for iterating usages and commands for navigating to other members in the inheritance hierarchy (Base Symbols, Derived Symbols).
In this case, you can invoke Go to Declaration again or use the Next arrow in the pop-up (Ctrl+Alt+PageDown) to return to the usage. If you repeat this command yet another time, ReSharper will switch the 'usage iteration' mode.
In the 'usage iteration' mode, you can navigate through the symbol usages as follows:
- Invoke Go to Declaration to go to the next usage, if any, and so on, subsequently navigating through all symbol usages. The total number of symbol usages in the solution appears in the usage iteration pop-up.
- Use Next and Back buttons in the usage iteration pop-up (Ctrl+Alt+PageDown/Ctrl+Alt+PageUp) to go to next and previous usages.
- Click Show in Find Results in the usage iteration pop-up to display all usages of the symbol in the Find Results window, where you can analyze the usages .
- To navigate through symbol usages in the current document, click the icon at the top of the marker bar.
This feature is supported in the following languages/technologies:
The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section.
- Go to Everything/Type
- Go To File
- Go to File Member
- Go to Symbol
- Go to Base Symbols
- Go to Derived Symbols
- Go to Implementation
- Go to Type of Symbol
- Go to Usages of Symbol
- Navigate To
- Go to Containing Declaration
- Navigation by Name
- Navigation from Symbols
- Navigate To
- Context Navigation
- Navigating to Recent Locations
- Structural Search and Replace