C#list.Orderby降 [英] C# list.Orderby descending

查看:99
本文介绍了C#list.Orderby降的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使这个返回结果,但降序排列。 ?这是可能的。

I want to make this return the result, but in descending order. Is that possible?

 var newList = list.OrderBy(x => x.Product.Name).toList();



和上面一样,但逆转。

Like above, but reversed.

推荐答案

当然:

var newList = list.OrderByDescending(x => x.Product.Name).ToList();



文件:的 OrderByDescending(IEnumerable的,Func键)

在回应您的评论

var newList = list.OrderByDescending(x => x.Product.Name)
                  .ThenBy(x => x.Product.Price)
                  .ToList();

这篇关于C#list.Orderby降的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆