Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Preliminary version of TimeRange.cs
public class TimeRange
{
private Func<DateTime, DateTime> _delta;
private TimeRange(Func<DateTime, DateTime> delta)
{
_delta = delta;
}
public DateTime Add(DateTime date)
{
return _delta(date);
}
public static readonly TimeRange OneDay = new TimeRange(dt => dt.AddDays(1);
public static readonly TimeRange OneYear = new TimeRange(dt => dt.AddYears(1));
public static readonly TimeRange OneMonth = new TimeRange(dt => dt.AddMonths(1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment