|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Working with Class View
Class View provides an alternative, code-centric view of your projects, making it easier to navigate to the symbols in code. These symbols, which are organized by project, are displayed in a hierarchical tree view, indicating the containment relationships between them. Other structural information such as base classes and interfaces, and overrideable methods may also appear.
Each symbol is represented by an icon indicating its type and is expandable if it contains other symbols. You can get a brief description of the symbol in a ToolTip by moving the mouse over its icon. Click the plus (+) symbol next to the icon or press the add (+) key on the numeric keypad to expand a symbol and display its members. You can also press the asterisk (*) key on the numeric keypad to recursively expand the entire sub-tree under the symbol.
Some symbols, when selected, display their properties in the Properties window. These properties can be viewed and edited.
Tip You can select multiple symbols simultaneously in Class View using the SHIFT and CTRL keys. This is useful for certain operations, such as source code control commands or dragging and dropping symbols.
As you edit your code, Class View updates its contents automatically to reflect the changes. As a result, no refresh command is needed.
Navigating to Code from Class View
Class View provides several commands for navigating to definitions of symbols and their uses in code (references).
To navigate to a definition or declaration
- Double-click the symbol.
- Right-click the symbol and then choose either Go To Definition (F12) or Go To Declaration (CTRL+F12).
The source file containing the definition or declaration opens in the Code Editor and the insertion point is placed there. If the source file is not available, double-clicking browses to the symbol in Object Browser.
To browse a definition
- Right-click the symbol and choose Browse Definition.
Object Browser displays with the symbol selected. Its declaration appears in Description pane.
To navigate to a reference
- Right-click the symbol and choose Go To Reference (SHIFT+F12).
The source file containing the reference opens in the Code Editor and the insertion point is placed there.
Note References might not be available for all project types.
To find a symbol
- Right-click the symbol and choose Quick Find Symbol (SHIFT+ALT+F12).
This performs a search on the symbol using the options specified in the Find Symbol dialog box and displays the results (definitions and references) in the Find Symbol Results window. For more information on using Find Symbol, see the Find Symbol Dialog Box and Find Symbol Results Window topics.
Managing Projects in Class View
Class View provides the same commands for working with projects as does Solution Explorer, for example, build commands such as Build, Rebuild, Deploy, Project Dependencies. You can also specify the StartUp Project and initiate debugging.
Notes As you select symbols in Class View, the corresponding project and item(s) are also selected in Solution Explorer, and all of the commands that apply to that project are available.
You do not need to compile your projects to view their symbols in Class View. As you add or modify symbols in a project, it dynamically updates to reflect the changes. As a result, no refresh command is needed.
If your project is under source code control, Class View symbols also display a signal icon indicating the status of the file(s) that define the symbol. The common source code control commands, such as Check Out, Check In, and Get Latest Version are available on the symbol's context menu.
|To learn more about||See|
|Building projects||Preparing and Managing Builds|
|Deploying projects||Deploying Applications|
|Source code control for projects||Source Control Services|
Adding Code through Class View
Some Visual Studio .NET languages offer language-specific commands and wizards in the Class View context menu that enable you to add to or modify your code. These include classes, modules, interfaces, methods, variables, events.
For example, the context menu for an MFC project contains the Add Class to Project and Add Resource commands on the Add context menu. The exact commands and wizards that appear depend upon the programming language, the project type, and symbol you selected.
- For details about a specific Add wizard, click its Help button.
- For a list of Visual C++ .NET Add wizards, see Adding Functionality with Code Wizards.
- For a list of Visual C# .NET Add wizards, see Visual C# Code Wizards.
Visual C++ .NET Considerations
Visual C++ .NET provides real-time symbol information for Class View, Object Browser, and Intellisense through .Ncb files. An .Ncb file is automatically created for each project from its source files, and as such, can be deleted and re-created if statement completion or Class View information becomes slow or inaccurate. This can happen over a long period of time as thousands of symbols are added and removed.