Udostępnij za pośrednictwem


How to: Work with Class View

You can navigate from the Code Editor to Class View to examine object members and project references. You can also navigate from Class View to lines of code where symbols are defined, referenced, and used.

Each symbol is represented by an icon indicating its type. To view a brief description of any symbol, hover over its icon. To expand a symbol and display its members, click the empty triangle symbol next to the icon or press the add (+) key on the numeric keypad.

In Visual C#, certain symbols, when selected, display their properties in the Properties window. These properties can be viewed and edited.

Tip

To select multiple symbols simultaneously in Class View, press the SHIFT and CTRL keys as you click on them. This allows you to drag and drop groups of symbols.

As you edit your code, Class View updates its contents automatically to reflect the changes. As a result, you can select any symbol in the Code Editor and locate it instantly in the Class View hierarchy for the document you are editing.

To Synchronize Class View with the Code Editor

  1. Open a code document for editing in the Code Editor.

  2. Select Class View from the View menu to display the Class View window.

  3. Right-click on a symbol in Class View and select Find All References from its shortcut menu.

  4. In the Find Symbol Results window, double-click an entry to locate an instance of the symbol in your code.

  5. Place the cursor in the line of code that includes the instance of the symbol, and then press CTRL-D.

    The Find box on the Standard toolbar is selected.

  6. In the Find box, type the following text:

    >View.SynchronizeClassView

  7. Press ENTER.

    Class View automatically scrolls to the location of the selected symbol in its hierarchy.

Class View provides several commands for navigating to definitions of symbols and their uses in code (references). You can navigate to symbols defined in your code by double-clicking them. The source file opens in the Code Editor and scrolls to the definition or declaration. If a symbol is defined elsewhere, its declaration is displayed in the Object Browser.

To navigate to a definition or declaration

  • Double-click the symbol.

    —or—

    Right-click the symbol and then choose either Go To Definition or Go To Declaration.

To browse a definition

  • Right-click the symbol and choose Browse Definition.

    The Object Browser is displayed with the symbol selected. Its declaration appears in the Description pane.

To navigate to a reference

  • Right-click the symbol and choose Go To Reference.

    The source file containing the reference opens in the Code Editor, with the insertion point placed at the reference.

    Note

    References might not be available for all project types.

To find a symbol

See Also

Tasks

How to: Work with Folders in Class View

How to: Search for Objects, Definitions, and References (Symbols)

Reference

Class View

Object Browser

Class View and Object Browser Icons

Other Resources

Viewing Classes and Their Members

Browsing Through Code and Components