Sorting
OrderBy()
OrderByDescending()
ThenBy()
ThenByDescending()
Reverse()
// Some code
var itemList = context.Items.Where(x => !x.Items && x.DeliverySelection)
.OrderByDescending(x => x.Delivery.SubmissionDate)
//.ThenBy(x => x.Item);
Notes
If you want to call
ThenBy
, you should callOrderBy
first or you need to cast it toIOrderedQueryable
:var r = ((IOrderedQueryable<dynamic>)result).ThenBy(...);
ThenBy
will work sorting the second fields in the order you want if there are fields inOrderBy
with equal value
Last updated