2016年4月13日 星期三

sorted a Dictionary with C#

1. Using LINQ (Language-Integrated Query)
2. Converting Values and Keys to a List
3. Using delegate

Reference:

 1- How to sort a Dictionary with C#
 2- Sorts a Dictionary by keys and by values.
 3- 當心LINQ搜尋的效能陷阱

不想用LINQ、不想實作,有沒有更快速的方法?

有的,用SortedDictionary<TKey, TValue>Class取代Dictionary<TKey, TValue>即可自動以TKey做排序。

沒有留言:

張貼留言