In my last post I had talk about Creating projects, designing user interfaces, editing and formatting code, member list and statement completion. As I told in this post we discuss Code snippets, Outlining, Refactoring, Additional formatting options, Navigating and exploring code, Solution Explorer, Class view, Object browser etc. We talk it about one by one here:
In Visual Basic, C# and C++ you can right-click in a code file and select “Insert Snippet” to automatically add commonly used constructs to your code. The following illustration shows some of the many Visual Basic code snippets.
The following C++ example shows the “Surround With” drop-down box. Selecting an item causes the construct, for example an #ifdef / #endif directive, to be placed around the currently highlighted line:
You can also use code snippets to intelligently generate constructs such as switch statements based on a supplied enumeration. First, generate the switch statement by typing sw . When you replace the switch parameter with the name of an enum variable, a case statement is added for each member of the enum.
The outlining feature enables you to collapse methods, classes and comments that you are not actively working on so that you can navigate more easily between the parts you are working on. Use the plus and minus icon on the left side of the text to collapse or expand a section of code.
Refactoring (Visual Basic and C# only)
In Visual Basic and C# you can use the refactoring feature “Rename” to intelligently rename your variables, methods and types. You can use the “Extract Method” refactoring feature to pull a section of code from an existing method and place it into a new method.
Additional formatting options
From the Edit > Advanced menu you can apply additional formatting options such as commenting or uncommenting selected lines of code, or reformatting selected code according to the formatting settings.
In Visual Studio 11 for Windows Developer Preview this tool has many new features including an embedded class view and call hierarchy. You can right-click on a file and drill in to the methods and variables it contains. You can then navigate to an item by clicking on it, or see call hierarchy information by right-clicking on the item. The following illustration shows the view in a C++ solution after the user has right-clicked on the GetStringRepresentation method:
The new search bar at the top of Solution Explorer can be used to search for all instances of string text anywhere in the solution.
The Object Browser enables you to inspect types and methods contained in many kinds of executable files, including Windows Runtime packages. You can filter on the kind of components you want to inspect, and the kind of code elements within those components. Icons next to the element indicate whether it is a namespace, interface, class, public or protected method, and so on. In Visual Basic or Visual C++, when you press F12 for “Go To Definition” with the cursor on a Windows Runtime type, the Object Browser is invoked and navigates to the object. You can right-click on a code element and select “Find All References” to return a list of all references to that type in your current solution.
The Navigation Bar is similar to previous releases of Visual Studio. It is located at the top of the code editor window. It provides a quick way to navigate to variables, types, and methods within the current code file. The following illustration shows the navigation bar in a C# code file. Note that in a code-behind file, the Navigation Bar shows all methods and members in a class, including the auto-generated methods and members in a separate file, and not just the methods in the partial class on the current file.
Building and Compiling
The build system and all compilers in Visual Studio 11 for Windows Developer Preview fully support Metro style apps using the full syntax of each supported language. The Visual C++ compiler supports some new language constructs that simplify working with Windows Runtime types.
Visual Studio includes a powerful debugger with many new features to support debugging Metro style apps. You can debug a Metro style application locally, similar to a classic Windows application. You can also debug in the Simulator on the local machine, or you can debug remotely on a tethered device.
Metadata for a Metro style app is stored in a package manifest file in XML format. Visual Studio provides a manifest designer that enables you to set properties on the manifest.
Visual Studio provides the tools you need to publish your Metro style application on the Windows Store. For more information, see Selling Your Apps (This feature is not available in Windows Developer Preview).