赞
踩
字典 降序 从高到低
- //村里选举 主任 的存这个list
- List<int> director = new List<int>();
- Dictionary<int, string> directorDict = new Dictionary<int, string>();
- ///添加 成绩 跟姓名
- directorDict.Add(villageCommitteeApplyPositionInfo[i].NumberOfVotes, RoleManager.GetRoleNameByID(villageCommitteeApplyPositionInfo[i].RoleID).ToString());
- //转换 排序
- Dictionary<int, string> dic1_SortedByKey = directorDict.OrderByDescending(p => p.Key).ToDictionary(p => p.Key, o => o.Value);
- foreach (var item in dic1_SortedByKey)
- {
- print(item.Key + ":" + item.Value);
- }
集合 排序 从高到低
-
- //村里选举 主任 的存这个list
- List<int> director = new List<int>();
- director.Add(villageCommitteeApplyPositionInfo[i].NumberOfVotes);
- director.Sort((x, y) => -x.CompareTo(y));//降序 从高到低
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。