Searching for Symbols: Objects, Definitions and References
Because the Object Browser is capable of displaying a large number of objects and members, it is important to be able to find symbols of interest quickly and easily. You can use the Find Symbol dialog box to easily find such symbols or to locate sections of code that use the symbol.
Find Symbol is useful for:
- Searching for definition of a symbol within your project. It's also useful for discovering multiple definitions of a symbol.
- Searching for uses of a symbol (references) within your code.
- Discovering names of objects and members in referenced and external components, allowing you to learn about its functionality.
- Finding symbols and browsing to their definitions in the Object Browser to discover their syntax and other information.
Find Symbol is different from finding text in that it:
- Allows you to limit the search scope to include only symbols, ignoring text in comments.
- Indicates definitions and references (when available) to the symbol in the Find Symbol Results window.
- Allows you to search in external components for which you do not have the source code.
The scope that Find Symbol uses in its search is the same browsing scope currently in use by the Object Browser. Changing or customizing the scope here also updates the display in the Object Browser. For more information about the browsing scope, see Viewing and Altering the Browsing Scope.
To open the Find Symbol dialog box, either press ALT+F12, or click the Find Symbol button on the Object Browser toolbar, or on the Edit menu, click Find and Replace and then Find Symbol.
To find a symbol
- In the Find what box, enter all or part of the name of the symbol you want to find.
- You can limit the search by specifying the browsing scope in which to search. In the Look in combo box, select either Active Project or Selected Components. Active Project confines the search to the active project and its referenced components only, while Selected Components searches within the user-defined browsing scope, which can include projects and their referenced components as well as other external components.
- If your search scope is set to Selected Components, clicking the ellipsis (...) button displays the Selected Components dialog box, which allows you to change the Selected Components browsing scope. Note that this also updates the display in the Object Browser.
- To limit the search to the contents of your projects only, clear the Look in References check box.
- You can further refine the search by specifying search options. Select either Match substring, Match whole word, or Match prefix. In addition, you can check the Match case check box if you want the search to be case-sensitive. For more information about these options and what they do, see Find Symbol Dialog Box.
- After specifying the criteria, click the Find button to perform the search.
The results of the search display in the Find Symbol Results Window. You can navigate to the symbol in code by either double-clicking the result or by choosing Goto Definition from its context menu. For external components, you can browse to their definition in the Object Browser from here as well. If references are available for the symbol, you can expand the node to see its uses in code and navigate to them.
To find a symbol without using the Find Symbol dialog box
- Invoke the Quick Find Symbol command by pressing ALT+SHIFT+F12 on a selected symbol. This command is available in most places in Visual Studio .NET, such as the Code/Text Editor, Class View, and Command Window.
See Also
Find Symbol Dialog Box | Find Symbol Results Window | Find Symbol Command | Object Browser Elements | Navigating in the Object Browser | Viewing and Altering the Browsing Scope