Find referenced code
This command helps you find any outgoing references within a certain scope, which can be as narrow as a function or as large as a project.
This command comes in handy when you are going to move a class or a method to another place. You will be able to use the list of outgoing references to estimate additional changes that the move will require.
Consider the ExternalSymbols
class below. If you run the command on the constructor, the search result will be a single usage of the method Divide
, because it is defined outside the constructor. If you run the command on the class, the search result will be the usage of System.ArgumentOutOfRangeException
, because the rest is defined inside the class.
If you run the command on a project, search results will include usages of symbols from referenced assemblies and usages of symbols from other projects in your solution, if any.
There are two ways to run the search for external symbols: if the scope is a project, a project folder, or a file, start the search from the Solution Explorer; if the scope is a class or a function, start the search from the editor.
Find usages of the symbols defined outside the current scope
Do one of the following:
Select a project, a project folder, or a file in the Solution Explorer.
In the editor, place the caret at a function or class.
From the main menu, choose Referenced Code in the Navigate To menu.
or press Control+Shift+G or choose from the main menu, and then selectThe search results appear in the Find Results window, where you can further analyze the results.