Cool new C# syntactic sugar

Just the other day I ranted about all the explicit get; set; implementation and I found this out today.

I was reviewing some code and I saw something like this

 class MyClass
{
    public int Property {
        get; set;  
    }
}

class Program
{
    static void Main(string[] args)
    {
        MyClass mc = new MyClass();
        mc.Property = 42;
        Console.WriteLine(mc.Property);
    }
}

I was completely confused. How the hell is there a abstract property in a concrete class? Then I figured out that this is new short-hand supported by Visual Studio 2008 (code-named Orcas and you can check this out in the latest beta).

The compiler generates the field for the property and also generates the code in the get set to point to the field.

 internal class MyClass
{
    // Fields
    [CompilerGenerated]
    private int <Property>k__BackingField;

    // Properties
    public int Property
    {
        [CompilerGenerated]
        get
        {
            return this.<Property>k__BackingField;
        }
        [CompilerGenerated]
        set
        {
            this.<Property>k__BackingField = value;
        }
    }
}