今天尝试了一种List的快速排序方法,较为简便。
List<T> pList;//对其按某一值递增排序
pList.Sort((Comparison<T>)delegate(T a, T b) { return a.int > b.int ? 1 : a.int == b.int ? 0 : -1; });
//其中a.int和b.int表示按某一数字
//实例如下
List<int> pList;
pList.Sort((Comparison<int>)delegate(int a,int b){return a>b?1:a==b?0:-1;});