private List _dates;
public List Dates
{
get { return _dates; }
set { _dates = value; }
}
OR
publi
Use the former if you need to add some kind of logic to your getter/setters.
Use the latter otherwise. It makes things much cleaner. You can also achieve read-only properties using auto properties:
public List Dates { get; private set; }
Or, if you don't want people to add any items to the list through the property you can resort to the former syntax:
private List _dates = new List();
private ReadOnlyCollection _readOnlyDates =
new ReadOnlyCollection(_dates);
public ReadOnlyCollection Dates
{
get { return _readOnlyDates; }
}