Created
March 13, 2013 01:39
-
-
Save MisterJames/5148715 to your computer and use it in GitHub Desktop.
A condensed version of building a list of valid times for a user to select from.
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
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