static void SortDictionary()
{
Dictionary<string, string> diction = new Dictionary<string,string>();
diction.Add("3", "three");
diction.Add("1", "one");
diction.Add("5", "five");
diction.Add("2", "two");
List<KeyValuePair<string, string>> sortList = diction.ToList();
var sorted = from entry in diction orderby entry.Value ascending select entry;
Console.ReadLine();
}
19 如何按值对字典进行排序
最新推荐文章于 2022-12-19 11:08:09 发布