Support for Test First Development
The integrated development environment (IDE) for Visual C# and Visual Basic is now able to create code stubs for new members and types even before they have been defined. This allows programmers to begin their process by writing tests and only afterwards create the code needed to compile those tests. The work is aided by the suggestion mode of IntelliSense, which prevents automatic completion of hitherto undefined members or types.
Support for More than One Monitor
Another improvement is that the Design view and Code Editor document windows now can be dragged outside of the IDE window, allowing them to see reviewed side by side.
Zooming in and out has never been easier. Users can simply move their mouse’s scroll wheel while holding down CTRL to change the size of the display in any text- or code-editing window. The output window and other textual tool windows have similar zoom controls, although design surfaces and icon-containing tool windows (like Solution Explorer and Toolbox) do not.
Earlier versions of Visual Studio allowed users to select a region by holding Alt while selecting a rectangular region with their mouse, perhaps to copy or delete text. In the 2010 version, this feature has been expanded as follows:
- A multi-line insertion point can be created for copied or new text by specifying a zero-character width for vertical selections.
- The contents of one box selection can be pasted into another with ease.
- New text will automatically appear on each line when it is typed into a box selection.
These features make it easy to add comments, set fields, or change access modifiers, because they can operate on statement groups in quick succession.
The Hierarchy of Calls
Visual C++ and Visual C# offer Call Hierarchy, which facilitates better navigation by displaying these sections of code:
- Overridden abstract or virtual members
- Implementations of members of the interface
- Calls made to and from specific constructors, properties, and methods
Developers can use Call Hierarchy to examine entry points in several code levels and to explore complex method-call chains. Doing so helps them understand possible execution paths, the consequences of making certain changes, and the overall flow of the code. In addition, the debugger’s call stack is not available during the design phase, but Call Hierarchy is.
One pane of the Call Hierarchy window displays the name of the member. When the member node is expanded, subnodes become visible for the Calls To and Calls From member names. Users can view all the members that call a specific member by expanding the Calls To node. Similarly, users can view all the members called by a specific member by expanding the Calls From node. Finally, users can navigate the caller stack by expanding individual subnode members within the nodes.
When searching for a specific file or symbol in the source code, the Navigate To feature can be extremely helpful, because it can help users identify the best set of matching query results. Users can use underscore characters to break a symbol down into keywords, and Camel casing to seek keywords within a symbol.
To highlight all instances of a specific symbol within a document, simply click on that symbol in the source code. The highlighted results could include references, declarations, and the other symbols that one would expect to receive with Find All references, such as properties, methods, variables, objects, and class names. The keywords for many control structures are also highlighted in Visual Basic.
To quickly jump to the next highlighted section, users can press CTRL+SHIFT+DOWN ARROW (or CTRL+SHIFT+UP ARROW to jump to the previous highlighted section).
Generate From Usage
This handy new feature allows developers to use members and classes even before they have been defined. The feature creates stubs for any undefined enums, fields, properties, methods, constructors, or classes, and this can be done without changing location within the code, which too often interrupts the developer’s workflow. This feature supports test-first development and other common styles of programming.
The Suggestion Mode of IntelliSense
Developers in need of statement completion can choose between Completion Mode and Suggestion Mode when using IntelliSense. Suggestion Mode is most appropriate when members and classes need to be used before they have been defined. In this mode, any typed text is added to the code. In Completion Mode, the editor places the entry as highlighted text on the list of members.
Users can easily jump between Suggestion Mode and Completion Mode without moving their hands from the keyboard, simply by pressing CTRL+ALT+SPACEBAR.