Skip to content

Instantly share code, notes, and snippets.

@wickedshimmy
Forked from petejohanson/gist:1690043
Created January 27, 2012 18:34
Show Gist options
  • Save wickedshimmy/1690202 to your computer and use it in GitHub Desktop.
Save wickedshimmy/1690202 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),
}.OrderBy (dt => dt.Date)
.ThenByDescending (dt => dt);
@wickedshimmy
Copy link
Author

Save the grouping/bind operations; ThenBy only operates within equivalent ordering classes to begin with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment