Skip to content

Instantly share code, notes, and snippets.

@petejohanson
Created January 27, 2012 17:59
Show Gist options
  • Save petejohanson/1690043 to your computer and use it in GitHub Desktop.
Save petejohanson/1690043 to your computer and use it in GitHub Desktop.
Fun Friday Algorithm!
new[] {
new DateTime (2012, 01, 01, 13, 0, 0),
new DateTime (2012, 01, 01, 9, 0, 0),
new DateTime (2012, 01, 02, 1, 0, 0),
new DateTime (2012, 01, 02, 23, 10, 0),
}.GroupBy (dt => dt.Date)
.OrderBy (grp => grp.Key)
.SelectMany (g => g.OrderByDescending (d => d))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment