17Aug/110
Automatic Get/Set Visual C# 2010
One of my favorite features of c#. Automatic getters/setters!
Before, one would have to declare a variable.
private int _x;
And then write get/set methods:
public int X{
get{return _x;}
set{x=value;}
}
However, in VISUAL C# 2010 - you can now do the following:
public int X{get;set;} Which is the same as the code above!
Note: If you want to wrap any validation or anything around the get/set you will still need to write out the full get/set. However, for quick variables that require no extra work - the automatic get/set is a lifesaver! (or timesaver - if you're life is not in danger...whichever you prefer)