Visual Studio Orcas Beta 1 

In my ongoing process to learn new stuff I use my blog a lot as a `note to self` tool. To remember all the new stuff concerning Orcas I will dedicate a section of my blog to the New Language Features.

The first feature I add here is the Automatic Properties feature in C#.

Don`t you hate it when you have to write these long sections of code with nothing more than fields with the get and set operations? I`m sure you will recognize it when you see it.

This is what you did before Orcas:

public class Animal
{
   private string name ;
   private string species ;
   private int legcount ;

   public string Name
   {
      get
      {
         return name;
      }
      set
      {
         name = value;
      }
   }

   public string Species
   {
      get
      {
         return species;
      }
      set
      {
         species = value;
      }
   }

   public int LegCount
   {
      get
      {
         return legcount;
      }
      set
      {
         legcount = value ;
      }
   }
}

Developer X wants the private field close to the get/set routine, Developer Y wants all the private fields bundled together first and following after that the get/set sections. You can close down that discussion with Orcas and you can now bring this back to:

public class Animal
{
   public string Name { get; set; }
   public string Species { get; set; }
   public int LegCount { get; set; }
}

Don't you love it? The compiler creates the private field and the default get/set operations for you.

Now you ask, why don't you just use the fields to begin with? Well, there are some good reasons to not using the fields. First, you won't be able to change them to properties later on, when you decide you need some validation in your get/set logic without having to compile the assemblies using these fields. And the other thing is that it is not so easy to databind against fields.