C# list.Orderby descending

I would like to receive a list sorted by 'Product.Name' in descending order.

Similar to the function below which sorts the list in ascending order, just in reverse, is this possible?

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

Sure:

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

Doc: OrderByDescending(IEnumerable, Func).

In response to your comment:

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

Yes. Use OrderByDescending instead of OrderBy.


list.OrderByDescending();

works for me.


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

This should do the job.