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 callOrderByfirst or you need to cast it toIOrderedQueryable:var r = ((IOrderedQueryable<dynamic>)result).ThenBy(...);ThenBywill work sorting the second fields in the order you want if there are fields inOrderBywith equal value
Last updated