Zodiac Signs: DateRange Class
Posted
Mon, Jul 6 2009 14:56
by
Deborah Kurata
This entry details the implementation of the DateRange class from this example in C#:
public class DateRange
{
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
// Constructor
public DateRange(DateTime startdate, DateTime enddate)
{
this.StartDate = startdate;
this.EndDate = enddate;
}
}
This class uses the automatically implemented properties feature that was introduced to C# in .NET 3.5 to define the two DateTime properties.
The constructor in this example creates a DateRange with an appropriate start date and end date. Though this class was created for the Zodiac Signs example, it could be used anywhere a DateRange is needed.
Enjoy!