June 7, 2007

C# 3.0 - Automatic Properties

Creating loads of get,set to properties is always a pain. I had my own macro do that.. but with c# 3.0 automatic properties will take care of that. This will avoid us manually create private variables and assign them to get,set. The c# 3.0 compiler will create them automatically.
So the new Property code will look something like this..

public class Car {
public string CarModel {
get;
set;
}

public int MakeYear {
get;
set;
}
}

No comments: