There are many visual designers in Visual Studio that allow you to drag-and-drop
controls onto the screen, in what is often referred to as Rapid Application
Development (RAD). However, most applications of any significance require
code that defines the logic of that application. Visual Studio recognizes this by
supporting Code-Focused RAD—tools that help you write code faster. This
section shows a few of the ways you can navigate code, and how to add
snippets and refactor code.
Visual Studio has several features supporting code navigation, including Call
Hierarchy, Navigate To, Highlighting References, and Live Semantic Errors.
The last two are not really navigation features, but they do help you understand
Call Hierarchy allows you to view callers and callees to a type member in your
code. You can open the Call Hierarchy window (see Figure 8) by selecting the
type member name you’re interested in and pressing Ctrl+K+T.
Call Hierarchy lets you view callers and callees to a type member.
The Call Hierarchy window also lets you navigate through code. To navigate
to a specific location, double-click on that location in the Call Hierarchy
window. You can open the branches of the tree by clicking an arrow to view
either Calls To or Calls From the location of the arrow.
Navigate To lets you quickly move to anywhere in your code by typing a
search term. Type Ctrl+, (comma) to display the Navigate To window
shown in the Figure below.
The Figure above shows how Navigate To lets you search and move to code quickly.
After the Navigate To window appears, you can type a Search term and all the
matching members will appear in the Results window. You can double-click
any item, or select an item and click the OK button, and Visual Studio will
take you to the right location.
The Highlighting References feature allows you to select an identifier and
Visual Studio highlights all the references to that identifier. Figure below shows
how this works.
The Figure above. Highlight References shows the selected identifier and references.
In the Figure above, we selected the method identifier, Level2. Visual Studio
highlighted the reference to that identifier inside the Main method.
Live Semantic Errors
Live semantic errors show you problems with your code as you type. You can
see compiler errors and warnings without building your code. Figure 11 shows
what a Live Semantic Error looks like.
The Figure above. Live Semantic Errors show you problems as you type.
The example in the Figure above is missing an end quote, which is a compiler error.
The Live Semantic Error appears as a squiggly line under the location of the
error. For warnings, you receive a green squiggly line.
Joe Mayo is an author, independent consultant, and instructor specializing in Microsoft .NET and Windows 8 technology. He has several years of software development experience and has worked with .NET since July 2000.