Posted by Joe | Posted in C# | Posted on 17-11-2009
Automatic Properties were a nice addition to C# 3 and I use them all the time. A lot of people may already know this but somehow I only found out this week; you can create a read only automatic property simply by adding the ‘private’ keyword before ‘set’:
public class UserEventArgs : EventArgs
{
public UserEventArgs(int userID)
{
UserID = userID;
}
public int UserID { get; private set; }
}



Great tip.. NERD!