开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜