Sorting Entities in LINQ
Learn about LINQ extension methods for sorting sequences like OrderBy, ThenBy, Order, and OrderDescending.
Other commonly used extension methods are OrderBy
and ThenBy
, used for sorting a sequence. Extension methods can be chained if the previous method returns another sequence, a type that implements the IEnumerable<T>
interface.
Sorting by a single property using OrderBy
Let’s continue working with the current project to explore sorting:
Step 1: Append a call to OrderBy
to the end of the existing query, as ...