O'Reilly logo
  • Zachary Kreft thinks this is interesting:

ThenBy

From

Cover of LINQ Pocket Reference

Note

The name "ThenBy" is ironic: the underlying code will execute the sorting in the reverse of the order the commands are issued (at least, that would be the most efficient way to do it). You sort from the least significant key to the most significant, using a stable sorting algorithm that will not affect the order of identical values. Each successive resorting makes itself the basis of how it's sorted while allowing the others to remain within items identical to the present key. So the first sort we named is the primary order and the others exist within items that are identical according to that key.

Since the query exists as layers of decoration it's likely that some optimization occurs before execution, inclu...