C# 3.0 Automatic Property

C# introduces a number of syntactic sugar, including Automatic Property link. A question was asked, why is this useful, what is the advantage of this approach compared to exposing the field as public field?

The advantage of the automatic property is that while you have a much cleaner code, you still have encapsulation, you can restrict the setter, so only internal classes, or descendant classes can update the property.

 public class AutomaticPropertyClass
    public string PublicProperty { get; set; }
    public int    ReadOnlyProperty { get; private set; }
    public double InternalProperty { get; internal set; }
    public char   ProtectedProperty { get; protected set; }

That code is much simpler than having to declare private field and then the property, and the developer still can define the accessibility. Yes, this is quite old, but since I was asked that question, might as well blog about it. :)