对一个Dictionary<TKey, TValue>进行值排序可以用LINQ:
Dictionary<string, string> MyDictionary = new Dictionary<string, string>();
MyDictionary = (from entry in MyDictionary
orderby entry.Value ascending
select entry).ToDictionary(pair => pair.Key, pair => pair.Value);
C# Dictionary(字典)的键、值排序
最新推荐文章于 2024-07-11 22:56:56 发布