44Microsoft Visual Studio 2010: A Beginner’s Guide

The following sections examine various elements of the Code editor, starting with class and member locators.

Class and Member Locators

The two drop-down lists, class locator and member locator, at the top of the editor are for navigating the code. If you have multiple classes in your file, you can use the class locator drop-down list on the left to select the class you want to find, and the editor will move you to the first line of that class declaration. In practice, I only put a single class within

a single file, so the class locator doesn’t get much attention. However, you will have VS wizards that automatically generate code and put many classes in the same file, and the class locator is very useful if you want to find a particular class and learn about what the automatically generated code is doing. The member locator drop-down list on the top right contains a list of methods and other members for the class selected in the class locator. The only class member we’ve discussed so far is the method, but there are more, as you’ll learn in upcoming chapters. Selecting a member causes the editor to move you to the first line of that class member. Whenever you find yourself scrolling through a large file, remember that the member locator will help you find what you’re looking for quickly.

The vertical bar on the left side of the editor is called the indicator margin, where you’ll see icons for features such as bookmarks and debug breakpoints. The next section discusses bookmarks.

Bookmarks

Figure 2-3 shows a bookmark on the line for the program class. Bookmarks allow you to navigate code quickly without manual navigation when working with multiple documents or multiple locations within the same document. Table 2-1 shows a list of keyboard commands for bookmarks.

Key Code

CTRL-B,T

CTRL-B,N

CTRL-B,P

CTRL-B,C

CTRL-W,B

Meaning

Toggle a bookmark on or off

Move to next bookmark

Move to previous bookmark

Clear all bookmarks

Open the Bookmarks window

Table 2-1 Bookmark Shortcut Keys

Page 67
Image 67
Microsoft 9GD00001 manual Class and Member Locators, Bookmarks, Bookmark Shortcut Keys