A Glimpse at Microsoft Visual Studio 2010

Introduction

In this article I am going let you know the notable features of Microsoft Visual Studio 2010 IDE Professional Edition which hit my eye at a first glimpse. Currently only the beta versions of Visual Studio 2010 and .NET framework 4.0 are available, but the actual release is expected sometime in the first quarter of this year.

Not surprisingly it provides support for the .NET framework 2.0, 3.0, 3.5 and 4.0. The target .NET framework SDK can be chosen while creating the project initially.

Here's where you can download the Beta version of Microsoft Visual Studio 2010.

Visual Changes

I opened the Microsoft Visual Studio 2010 IDE for the first time and I was totally astonished by the look and feel of the IDE, in fact it took me a little while to recognize it to be Visual Studio. The style was totally changed from its traditional colors and shapes.

To be frank the readability of the texts were so much improved, similar to that of the WPF vector based line and graphics. All the unwanted lines and gradients had been removed. Even the infamous Visual Studio icon has been changed too. The screen shot below provides enough evidence.


Figure 1.0

Support for Microsoft F#

Visual F# is a new language introduced by Microsoft along with .NET framework 4.0 and it is integrated very well for doing the development in Visual Studio 2010. Visual F# is a language which supports functional programming as well as object oriented programming.

The .NET framework is packed with a tool named fsi.exe, which is useful for running the F# commands instantly which can be compiled and executed on the fly. To open the tool open Visual Studio 2010 command prompt and type fsi and hit enter.

Below is the sample F# program:

  //First look at F#
  // Learn more about F# at http://fsharp.net
  
  //Importing required libraries
  open System
  open System.Windows.Forms
  
  //instantiates a Form
  let form = new Form();
  form.Width <- 200;
  form.Height <- 100;
  form.Text <- "First F# Program"
  
  let label = new Label()
  label.Text <- "This is a Label"
  form.Controls.Add(label)
  
  #if COMPILED
  [<STAThread>]
  do Application.Run(form)
  #endif

Fig 2.0 shows the output of the above F# program


Figure 2.0

Using Visual Studio 2010 provides F# projects to be created, built, debugged and deployed. It also provides good intellisence support for the language.

Currently there are only three kinds of projects available in Visual F# (one is Silverlight Library project) and a project for F# learning as shown in Fig 2.1


Figure 2.1

Integration of Sharepoint, Silverlight and projects for MS Office

Unlike the previous versions of Microsoft Visual Studio, the 2010 version come with a tight integration of Sharepoint project and tools for Office. It offers a wide range of projects in both categories.

With the help of the Office project, visual studio easily enables you to write macros and add ins using your favorite language C#. Below is a sample Word 2007 project.

  using System;
  using Microsoft.Office.Tools.Word;
  using Microsoft.VisualStudio.Tools.Applications.Runtime;
  using Office = Microsoft.Office.Core;
  using Word = Microsoft.Office.Interop.Word;
  
  namespace WordDocument1
  {
      public partial class ThisDocument
      {
          private void ThisDocument_Startup(object sender, System.EventArgs e)
          {
              //Add code to perform tasks on document startup
          }
  
          private void ThisDocument_Shutdown(object sender, System.EventArgs e)
          {
              //Add code to perform tasks on document shutdown
          }
  
          #region VSTO Designer generated code
  
          /// <summary>
          /// Required method for Designer support - do not modify
          /// the contents of this method with the code editor.
          /// </summary>
          private void InternalStartup()
          {
              this.Startup += new System.EventHandler(ThisDocument_Startup);
              this.Shutdown += new System.EventHandler(ThisDocument_Shutdown);
          }
  
          #endregion
      }
  }

In the above code see that the Word interop assemblies have been included in the class file automatically.

The XAML editor for Silverlight and Windows Presentation Foundation applications has also been improved a lot like drag dropping the data binding onto the WPF controls and in terms of intellisence support.

Easy Zoom-In and Zoom-Out of Editor Text

The zoom in and zoom out feature of the code editor will definitely be a surprising fact for the developers. You can easily zoom-in or zoom-out by pressing the Ctrl key and rotating the scroll up or down as you do with Internet Explorer or other Microsoft Applications. If you are not using the mouse, then you can make use of the percentage box which displays at the left bottom corner of the code editor.

Minimum zoom percentage is 20% and Maximum zoom percentage is 400%. For people who are not comfortable with the font sizes of the Visual Studio code editor this feature is a real bliss.

Navigate To Feature

This is a new search functionality introduced in Visual Studio 2010 which forms the latest member in the list of Object Browser, Find Symbol and Find Results.

Follow either of the two ways to open the Navigate To window:

  1. You can open the "Navigate To" window by pressing the keys "Ctrl + , " combination, note that the + also forms a part of the hot keys that is why I have enclosed them in double quotes.
  2. The other way would be to go to Edit and select "Navigate To"

The navigate to option will search and display the class, class members and objects used in the solution and will display the line number along with the file name with path.

When you double click on the search results, it acts like a "go to" definition and it take you to the definition of that result which would be a part of the current solution.

A major reason you would like this feature is that the search is performed so fast and changes on search text changed.

Search options available:

  1. You can enter the search text as all in lower case, so that it will perform a non-case sensitive search. If the search text contains any upper case letter, then the search becomes a case sensitive one.
  2. You can enter "Print s" which will search for code which has the words Print and s, the blank space is actually designated to act like an AND operator.
  3. You can also perform searches based on Pascal casing and underscored camel casing like "PMF" would search for a class or a member with name "PrintMessageFirst".

Fig 5.0 shows a sample Navigate To window:


Fig 5.0

A Glimpse at Microsoft Visual Studio 2010

Generating stub classes and members

In Microsoft Visual Studio 2005 and 2008 versions you would have seen an option like 'Generate Stub Method' which will generate a Stub method without any implementation, I'm sure that it would have been a very useful one in terms of not breaking the programming sequence during the process of coding.

In Visual Studio 2010, its one step further that you can generate Stub classes and even property members as well. This is really a handy feature.

[codesample.jpg]
Fig 6.0

As shown in Fig 6.0, when writing the code for creating an instance, the code editor understands that you are creating a class and it provides the below options.

  1. Generate class for Employee:
    When you click on this it automatically creates a class file called Employee.cs in the current project. The .cs file will contain an empty class called Employee.
  2. Generate new Type
    When you click on this option, It provides you with lot of options for creating the Type by showing the Generate New Type popup window as shown in Fig 6.1

    [generator.jpg]
    Fig 6.1

    In the window there are options to choose the access level to be provided for the new Type to be created, it should be a class/struct/interface/enum, the project to which the new .cs file should be added and an option to add the type to a specified file instead of creating a new one.

The same kind of flow applies to the properties as well. Fig 6.2 shows the sample for EmployeeName member for the Employee class. The option for creating it as a Field or Property is seen.

[codesample2.jpg]
Fig 6.2

Intellisence and Code Snippet Improvements

Visual Studio 2010 intellisence system come with two kinds of modes they are:

  1. Suggestion Mode
    When you want to type the classes and members before they are defined in your project, make use of the suggestion mode. Since it will not highlight the item from the intellisence list rather it will display the text you have entered. Below Fig 7.0 is a sample screenshot.

    [codesample3.jpg]
    Fig 7.0

  2. Completion Mode
    This is the classic way Intellisence would work with Visual Studio 2003, 2005, and 2008. It will insert the highlighted item from the list in spite of your typed value.

You can use the short cut key SHIFT + ALT + SPACE BAR in order to toggle between the Intellisence mode. There is also improved intellisence support for JavaScript.

As you can see in Fig 7.1, now code snippets are available in the aspx page as well. It is going to be really useful for the people like me who use the aspx source window for creating controls. Just enter text<button and double click it and it will create a button template for you.

[codesample4.jpg]
Fig 7.1

As you can see there are a number of code snippets available which are going to prove handy for web developers. It doesn't stop with the ASP.NET controls but the code snippet feature extends to the HTML and Jscript as well.

Debugger Breakpoint Improvements

There are a lot of debugger enhancements available in Visual Studio 2010. I am listing some of the enhancements done to the breakpoints feature in the 2010 IDE:

  1. Labeling the breakpoints:
    You can add labels to the breakpoints which can make it easily identifiable. In order to label a break point Right click on the break point and choose Edit Labels which will open the Edit break point labels window. Fig 8.0 shows a sample window which can be used to edit or create a new label for the break point.

    [codesample4.jpg]
    Fig 8.0

  2. Break Point search window
    There is a search window for the breakpoints. The short cut key to open the search window is Ctrl + D + B. Fig 8.1 shows a sample break point search window.

    [searchpoints.jpg]
    Fig 8.1

    There is also option to import and export break points to and from a project. The file should be in xml format.

Code Definition Window

The option 'Go to Definition' is not new to the Visual Studio 2005 and 2008 users. It was really a useful feature which helped in viewing the definition of a type or member in the code editor. But I always felt a little uneasy when I clicked the Go to definition. 2005 and 2008 IDEs would open the file separately but going back to the original place had to be done manually. This is where the Code Definition window comes into to play in Visual Studio 2010. It will open the definition code in the same code editor window as a code definition window. Fig 9.0 shows a sample Code Definition Window

[programcs.jpg]
Fig 9.0

In order to get to the code definition window click on the Type or member of the code definition window you want to see and use Ctrl + W + D. This will open the definition in the Code definition window as shown in the Fig 9.0 example.

Call Hierarchy

This is altogether a new feature in Visual Studio 2010. The short cut key for opening the Call Hierarchy window is Ctrl + W + K. But in order view the content in the Call Hierarchy window right click on the method and select View Call Hierarchy. Fig 10.0 shows the Call Hierarchy for the sample method PrintMessageFirst residing in PrintMessageClass class.

[hierarchy.jpg]
Fig 10.0

You would see two categories listed under the PrintMessageFirst method in Fig 10.0:

  1. Calls To 'PrintMessageFirst'
    This will list the set of methods which calls the PrintMessageFirst method. In our case it is the Main method.
  2. Call From 'PrintMessageFirst'
    This will list the set of methods called in the PrintMessageFirst method. In our case it is the WriteLine method.

It doesn't stop there, the hierarchy drill down goes on to Call to Main, Call From Main, Calls To WriteLine and Calls From WriteLine and so on.

Highlight references

In earlier versions of Microsoft Visual Studio if you have used a member in quite a few places in your class and you want to see the places where it has been used the option would be to use a Quick Find window. But in the 2010 IDE it has been made more simple and elegant. When you just click on the member, it highlights all the places where it has been used with a boxed selection as shown in Fig 11.0.

[codesample5.jpg]
Fig 11.0

In the above image just check how the member _messageText has been highlighted throughout the class PrintMessageClass.

Conclusion

The features mentioned in this article are related to the Professional Edition of Microsoft Visual Studio. The Team System version offers a cool feature for generating the Sequence Diagram, but it is a little disappointing not to find it in the Professional Edition. I hope that it gives a good kick start for exploring the Visual Studio 2010 IDE. I am sure that this article highlights some important features of Visual Studio 2010. We will keenly wait for the actual release of the IDE.



About the Author

V.N.S Arun

I work for an MNC in Bangalore, India. I am fond of writing articles, posting answers in forums and submitting tips in dotnet. To contact me please feel free to make use of the "Send Email" option next to the display name.

Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: November 20, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Are you wanting to target two or more platforms such as iOS, Android, and/or Windows? You are not alone. 90% of enterprises today are targeting two or more platforms. Attend this eSeminar to discover how mobile app developers can rely on one IDE to create applications across platforms and approaches (web, native, and/or hybrid), saving time, money, and effort and introducing apps to market faster. You'll learn the trade-offs for gaining long …

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds