A very simple and awesome new feature in 3.5 is Automatic Properties, the basic idea is that you just define the property name and the visibility of the getter and setter. No need to specify the private field and the body of the get and set to retrieve and set the value. So the snippet below:
private EntityState _EntityState;
public EntityState EntityState
{
get { return _EntityState; }
private set { _EntityState = value; }
}
Would become:
public EntityState EntityState { get; private set; }
The 3.5 framework handles creating the getter, setter, and private member for you. This small addition to the framework can made your code much cleaner.
Obviously it only helps for those situations where you are just retrieving the value / setting it, if you want to do any additional processing you’ll need to create your property the old fashioned way.
Automatic properties must have get and set declared, which is obvious considering that the private member is not accessible, so all access must go through the property
Disclaimer: This post is based on Orcas CTP June 2007