如何将以下LINQ语句转换为OrderByAscending而不是OrderByDescending?由于某种原因没有OrderByAscending:
var unProfParameterSets = RawAARdDDArray1
.Select((value, index) => new { value, index })
.OrderByDescending(item => item.value)
.Take(unProfParams)
.Select(item => RawParamSet[item.index])
.ToArray();
谢谢!
答案 0 :(得分:14)
以升序排序结果的方法是OrderBy
var unProfParameterSets = RawAARdDDArray1
.Select((value, index) => new { value, index })
.OrderBy(item => item.value)
.Take(unProfParams)
.Select(item => RawParamSet[item.index])
.ToArray();