遞增排序
Array.Sort<string>(myArray, new Comparison<string>((i1, i2) => i1.CompareTo(i2)));
遞減排序
Array.Sort<string>(myArray, new Comparison<string>((i1, i2) => i2.CompareTo(i1)));
參考
http://stackoverflow.com/questions/5430016/better-way-to-sort-array-in-descending-order
http://msdn.microsoft.com/zh-tw/library/35f0x18w.aspx (CompareTo 說明)
沒有留言:
張貼留言