Last active
October 10, 2017 06:37
-
-
Save jamescurran/24e4e1cfb4207feb406d7b46f593a272 to your computer and use it in GitHub Desktop.
Preliminary version of TimeRange.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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