query = query.OrderBy(p => p.IsTop).ThenOrderByDescending(p => p.JobId)?
I want to sort objects by IsTop
property ascending and then by JobId
property descending:
query = query.OrderBy(p => p.IsTop).ThenOrderByDescending(p => p.JobId);
How do I do this? I know the reverse:
query = query.OrderByDescending(p => p.IsTop).ThenBy(p=>p.JobId)
Syntax works but it's not what I want. What I want is actually whatever situ开发者_开发问答ation is the IsTop
items will be at the top!
Bool sorted in ascending order is false, true.
Try: query.OrderByDescending(p => p.IsTop).ThenByDescending(p => p.JobId);
query = query.OrderBy(p => p.IsTop).ThenByDescending(p => p.JobId);
精彩评论