Skip to content

Instantly share code, notes, and snippets.

@mahizsas
Forked from MisterJames/Build a list of valid times
Created April 4, 2013 06:49
Show Gist options
  • Save mahizsas/5308367 to your computer and use it in GitHub Desktop.
Save mahizsas/5308367 to your computer and use it in GitHub Desktop.
Build a list of valid times
List<string> times = new List<string>();
Enumerable.Range(0, 24).ToList()
.ForEach(hour => Enumerable.Range(0, 2).ToList()
.Select(x => string.Format("{0}:{1:00}", hour, x * 30))
.ToList()
.ForEach(timeslot=>times.Add(timeslot)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment