Go to Declaration
Use this command to navigate to the declaration of a symbol from any symbol usage. You can invoke this command from the Solution Explorer, from the File Structure window and other tool windows.
Navigate to a declaration of a symbol
Place the caret at a symbol in the editor or select the symbol in a tool window.
Choose Ctrl key.in the main menu, press Control+B, or click the symbol while holding the
If the command returns a single result, ReSharper navigates directly there. In case of multiple results, they will be listed in a drop-down where you can do one of the following:
By default, Go To Declaration works with Ctrl + left-click and with the middle button click. To disable this, clear the Rich mouse navigation in the editor checkbox on the page of ReSharper options (Alt+R, O). You can also Ctrl+Shift -click usages of symbols to display their declarations in the Peek Definition view. If you want to disable this, clear the Use Ctrl+Shift click to open the result in the peek view checkbox.
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 in referenced libraries, ReSharper navigates according to the settings defined on the Alt+R, O).page of ReSharper options (
Invoke this command on declarations
As Go to Declaration (including its Ctrl -click access) is one of the most frequently used commands, ReSharper streamlines your navigation experience letting you use this command in navigation scenarios related to usages of the declared symbol, so you can invoke Go to Declaration even if your caret is already at a symbol declaration to study symbol usages.
To configure how Go to Declaration behaves when invoked on a declaration, use the Smart Go to Declaration behavior selector on the page of ReSharper options (Alt+R, O), which provides the following options:
Show Navigate To menu — displays the Navigate To menu with all navigation destinations contextually available on the declaration. This menu is also always available with Control+Shift+G.
Show Usages of Symbol popup — list all usages of the declared symbol. You can also always get the list of usages with the Usages of Symbol command Control+Alt+F7.
Iterate usages — adds the corresponding command to the navigation menu, which enables the 'usage iteration' mode designated with a small popup in the upper-left corner of the editor:
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 popup.
Use Next and Back buttons in the usage iteration popup Control+Alt+PageDown/ Control+Alt+PageUp to go to next and previous usages.
To navigate through symbol usages in the current document, click the icon at the top of the marker bar.
Do nothing — Go to Declaration can only be invoked on symbol usages to go to its declaration.
Navigate to interface implementations in debug mode
In debug mode, if you navigate from a usage of an interface member, Go to Declaration will get you not to the interface declaration, but to the exact implementation of that member used in the current frame.
To configure this behavior, use the Navigate to actual type in Go to Declaration selector on the page of ReSharper options (Alt+R, O):
According to Visual Studio option — will navigate to the member implementation when the member is invoked on local variables, parameters, and fields that hold the interface type.
If the Enable property evaluation and other implicit function calls option on the page of Visual Studio's options is enabled, navigation to the implementation will also work on properties that hold the interface type.
If property evaluation is enabled, the getter of that property will be executed each time this action evaluates the actual type returned by a property.
In most cases the getter only returns the underlying value, but it can also contain resource-intensive code, such as database calls.
Disabled — will always navigate to the member declaration in the interface.
Local variables — will navigate to the member implementation when the member is invoked on local variables and parameters that hold the interface type.
Local variables and fields — will navigate to the member implementation when the member is invoked on local variables, parameters, and fields that hold the interface type.
Local variables, fields, and properties — will navigate to the member implementation when the member is invoked on local variables, parameters, fields, and properties that hold the interface type.
Similarly to According to Visual Studio option, beware of potential side effects of property evaluation.
This feature is supported in the following languages and 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.