排序双打的通用列表 [英] sorting a generic list of doubles
本文介绍了排序双打的通用列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个通用的双打列表,像这样在页面上显示:
I have a generic list of doubles that show on the page like this:
1199.17
1199.17
1161.67
1161.67
1161.67
1161.67
1161.67
1161.67
1161.67
1161.67
1161.67
1161.67
1161.67
1161.67
1161.67
1199.17
1349.17
1349.17
1349.17
1349.17
1349.17
1349.17
1311.67
1311.67
1311.67
1311.67
1311.67
1349.17
2174.17
2174.17
2174.17
2174.17
2136.67
2136.67
2136.67
2136.67
2174.17
2361.67
2361.67
2361.67
2361.67
2361.67
2361.67
2361.67
2361.67
2399.17
2849.17
2849.17
2849.17
2849.17
2849.17
2849.17
2849.17
2849.17
3111.67
3111.67
3111.67
3149.17
我正在尝试对它们进行排序,以便最低的双精度数排在第一位.
I am trying to order them so that the lowest double is first.
我尝试了doublePriceList.Sort(),但这没用.
I tried doublePriceList.Sort() but this did not work.
我该怎么做?
推荐答案
using System.Linq;
和
var sortedList = doublePriceList.OrderBy(d => d);
这篇关于排序双打的通用列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文