后的值后的字典我有一个排序的字典一个问题:排序的关键
SortedDictionary<string, List<int>> mySortedDictionary;
我想创建一个新的Dictionary<string,List<int>>
与mySortedDictionary,这是按值排序的数据(完全按项目数列表换句话说就是List.Count)升序,而lists.Count是相同的,按键按字母顺序升序排列。任何人都可以给我一个想法如何做到这一点?
mySortedDictionary.Add("orange", List<2,9>) //List.Count = 2
mySortedDictionary.Add("money", List<2,4,8,9>) //4
mySortedDictionary.Add("monkey", List<2,4,9>) //3
mySortedDictionary.Add("hokey", List<2,5,9>) //3
//result: order in new sorted Dictionary//
"orange", List<2,9>
"hokey", List<2,5,9>
"monkey", List<2,4,9>
"money", List<2,4,8,9>
预先感谢您的帮助!
字典本身没有任何订单。即使你想出了一种按特定顺序插入到字典中的算法,也不能保证你能以相同的顺序重新获得它们。 – Partha
@Partha'SortedDictionary'有一个命令('key') –