Browsing and Navigating Code
Browsing and Navigating Code
Often, you need to browse your own code or try to navigate your way through code that someone else has written. Visual Studio provides two basic kinds of tools for browsing code: When you have the source code When you have a compiled assembly The Code Editor has the following tools for browsing your own source code: Navigation bar: Allows you to jump to the classes and methods defined in a source code file Bookmarks: Allow you to place a bookmark in your code The Navigation bar appears at the top of a source code file in the Code Editor. The left drop-down box lists types or classes that you can find in the source code file. After selecting a type, you can view the types members in the right drop-down list. Selecting a member takes you to its declaration in source code. Figure 1-9 shows an example of selecting a types member from the Navigation bar. A bookmark sets a place in code where you can jump to via the Bookmark window. To set a bookmark in source code, do the following: 1. Position your cursor on the line where you want to set the bookmark. 2. Choose View Bookmark Window to open the Bookmark window. 3. Click the Toggle button on the far left of the Bookmark window to set the bookmark. 4. Type a descriptive name for the bookmark. After you set a bookmark, double-click the bookmark in the Bookmark window to jump to that place in the code.
138
Figure 1-9: Use the Navigation bar to select the types and members declared in source code.
Visual Studio provides the Object Browser, Class View, and Code Definition for viewing assemblies. See the section on browsing types in Chapter 2 of Book III for more information.
Visual Studio supports many programming languages. Visual Basic and C# are two popular .NET programming languages. This section shows you the highlights of using Visual Basic and C# with Visual Studio 2010. Mastering the basic syntax of programming languages, such as Visual Basic and C#, isnt the same as learning how to program. When you discover how to program, you also discover basic programming constructs, such as conditionals and iterators. By grasping the concepts of programming constructs, you can easily and quickly pick up any language syntax.