Skip to content

Instantly share code, notes, and snippets.

@jamescurran
Last active October 10, 2017 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamescurran/24e4e1cfb4207feb406d7b46f593a272 to your computer and use it in GitHub Desktop.
Save jamescurran/24e4e1cfb4207feb406d7b46f593a272 to your computer and use it in GitHub Desktop.
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