Dela via


Code Definition Window

The Code Definition window is a read-only editor view that displays the definition of a symbol in a code file stored in, or referenced by, the active project. To display this window, select Code Definition Window from the View menu. When the window first opens, it displays the definition for the last symbol selected. If no definition is available, No definition selected is displayed. This window can be docked along any convenient edge of the integrated development environment (IDE). By default, it is displayed beneath the Code Editor.

Note

The appearance of features in the IDE can depend on your active settings or edition, and might differ from those described in Help. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Working with Settings.

As you move the insertion point in the editor, or change the selection in Class View, the Object Browser, or Call Browser, the content of the Code Definition window is updated. For Visual C#, if a file is available that provides the definition for the symbol currently selected, the title bar of the Code Definition window displays the symbol name, and the Code Definition window displays a read-only view of the file at that location. If no such source file is available, the Code Definition window continues to display the last definition found. Only one instance of this window can be displayed.

Despite the fact that it is read-only, the Code Definition window is a fully functional editor window in many respects. For example, you can copy code from this window, and set bookmarks and breakpoints. To edit the definition displayed, right-click on the Code Definition window and select Edit Definition from its shortcut menu. This opens the source file for editing in the Code Editor, scrolls the document to the definition, and places the insertion point on the line where it begins.

  • Title bar
    Displays the window name plus the file name.

  • Definition pane
    Displays the definition for the item selected, when available.

Display Behavior

The Code Definition window is available while programming in Visual C++ and Visual C#.

Note

The Code Definition window is not supported for Visual Basic applications; therefore it does not display the definition for Visual Basic symbols that are selected in the Code Editor, Class View, or the Object Browser.

Here is a list of what is displayed for different kinds of selected symbols.

Visual C++ item selected

Definition window displays

Type Symbol

Class header file, scrolled to the start of the class declaration.

Function Symbol in Declaration or Reference

Source file containing the function definition, scrolled to the start of the function definition.

Function Symbol within actual Function Definition

Function declaration.

Symbol with no definition

No change.

Visual C# item selected

Definition window displays

Type Symbol

Source file containing the class definition, scrolled to the start of the class definition.

Partial Type Symbol

First type definition returned in the list of partial type definition locations.

Method Symbol

Source file containing the method definition, scrolled to the start of the method definition.

Symbol with no definition

No change.

See Also

Tasks

How to: Navigate Code and Text

Reference

Code and Text Editor

Other Resources

Editing Text, Code, and Markup

Coding Aids

Viewing Classes and Their Members

Browsing Through Code and Components