Visual Studio 2008 New Features

This is a list of the cool new features in Visual Studio 2008:

  1. When you debug your applications with Visual Studio 2008 you will have the option to debug right down into the Framework code (with an autodownload feature from an MSDN server)! read more
  2. Automatic properties in C#3
  3. In C# 3.0 you can write code like this:

            public string Name

    The compiler generates code like this:

            private string XX;
    public string Name
    get { return XX; }
    set { XX = value; }

    , where XX is not directly accessible to you in code of course. This only works for properties with both getter and setters

  4. Object Initializers in C# 3.0 and VB9
  5. In C# 3.0
    Thread myThread = new Thread(MyThreadMethod) {Name="my thread", IsBackground=true};

    In VB:

    Dim myThread As New Thread(AddressOf MyThreadMethod) With {.Name = "my thread", .IsBackground = True}

    So, object initialisers is a feature that lets you assign public properties (and public fields) straight after the constructor in braces, without having to repeat the object variable name and type separate statements.
    For example, when you type the following statement:

    TextBox t = new TextBox {Text="Hi", Multiline=true, Location = new Point(5,5), Size=new Size(50,100)};

    In VB:

    Dim t As New TextBox With {.Text = "Hi", .Multiline = True, .Location = New Point(5, 5), .Size = New Size(50, 100)}

    …the compiler generates IL similar to if you typed:

          TextBox t = new TextBox(); 
    t.Text = "Hi";
    t.Multiline = true;
    t.Location = new Point(5, 5);
    t.Size = new Size(50, 100);

    This feature saves you some typing and results in more concise code. While I like object initialisers, their full usefulness will become apparent when combined with the language enhancement that we look at next.

  6. Extension methods in C# 3.0 and VB9
  7. Partial Methods in C# 3.0
  8. WPF And Windows Forms Integration 

Leave a Reply

Your email address will not be published. Required fields are marked *