Tip 1 - Better Multiple Monitor Support
Visual Studio includes a vast number of windows – the Solution Explorer, the Properties window, the Class Viewer, and so forth. Visual Studio 2008 allows developers to move, resize, and pin these windows inside Visual Studio’s top-level window, or to float them and move them anywhere on the desktop, including to a secondary monitor. With Visual Studio 2010 you can also float code and designer windows and move them outside of the top-level window. Using this feature you can examine multiple files at once across multiple monitors.
Tip 2 - IntelliSense Improvements
Visual Studio 2010’s IntelliSense has been drastically improved. For starters, it’s noticeably faster than in previous versions. It’s also easier to find the type or member you’re looking for, as IntelliSense now searches for any matches that contain the text you enter rather than limiting the results to those terms that match directly.
For example, typing in Console.Window displays eight matches. As you’d expect, the list includes those members that start with the word Window – WindowHeight, WindowLeft, WindowTop, and WindowWidth – but it also includes those members that include the word Window – LargestWindowHeight, LargestWindowWidth, SetWindowPosition, and SetWindowSize. Additionally, you can search for Pascal cased types and members by entering just the capital letters in the type or member name. Entering Console.WH displays two properties: LargestWindowHeight and WindowHeight.
Programming methodologies like Test Driven Development (TDD) encourage writing code using a consume-first pattern. Before creating a class or adding a new method, developers first write a unit test. If you practice TDD or routinely write stub code that references classes or members that you’ve not yet created then you’re well aware of one of IntelliSense’s biggest annoyances – it overwrites any non-existent type or member names you type with the closest known match. For example, say that you start to write a unit test for a not yet created class named Cons.
When you type in the text Cons Visual Studio will suggest Console from the IntelliSense drop-down. When you enter a period or a left parenthesis, Visual Studio replaces what you had entered – Cons – with the selected type in the IntelliSense drop-down – Console. How annoying!
Visual Studio 2010’s IntelliSense makes it easier to practice consume-first development. You can toggle IntelliSense between its standard mode and the consume-first mode from the Edit menu’s IntelliSense submenu, or by using the keyboard shortcut Ctrl+Alt+Space. When using consume-first mode, IntelliSense will not overwrite unknown type or member names. What’s more, after entering the new type or method name you can use Visual Studio’s built-in refactoring tools to create the new class, method, or property with a single click of the mouse.
Tip 3 - Pin Watch Variables
When debugging, Visual Studio displays the name and value of a variable when you hover your mouse over it. In Visual Studio 2010 this information can be pinned to the same window the code you are debugging appears in. Pinning a variable allows you to observe how the variable’s value changes as you step through the code. You can also add comments to the pinned watch variable, and Visual Studio remembers and reloads these comments and the pinned watch variables the next time you launch the debugger.
Tip 4 - Better Searching
Visual Studio has long supported searches across documents in a project or Solution, but such searches were limited to specific substrings and returned no contextual information. Visual Studio 2010 greatly improves the search experience with the Navigate To window, which is accessible from the Edit menu. From the Navigate To window you can search across your entire Solution for files, types, methods, properties, fields, and events. Much like IntelliSense, the Navigate To window searches for any matching types or members that contain the string you enter. Likewise, you can search for Pascal cased types and members by entering just the capital letters.
The Navigate To window displays each matching result with an icon that indicates whether the match is a file, a type, a class, a property, et cetera. Selecting a result lists the project name, filename, and line number where it appears, and double-clicking a result opens the file at the appropriate line of code.
Tip 5 - Search the toolbox
Each new version of the .NET Framework introduces dozens of new controls to the Toolbox, but finding a control in the Toolbox is now easier than ever. Simply select the Toolbox window with your mouse (or hit Ctrl+W, X from your keyboard) and then start typing the name of the control you want to find. Visual Studio will select the first control it finds that starts with your input; toggle through multiple matches using the tab key.