开发者

query = query.OrderBy(p => p.IsTop).ThenOrderByDescending(p => p.JobId)?

开发者 https://www.devze.com 2023-02-17 08:33 出处:网络
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);

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号