当前位置:网站首页>C#的Dictionary字典集合按照key键进行升序和降序排列
C#的Dictionary字典集合按照key键进行升序和降序排列
2022-08-04 19:44:00 【幕尘枫】
//这个是集合
Dictionary<int, string> list = new Dictionary<int, string>();
//升序
Dictionary<int, string> dic_asc = list.OrderBy(p => p.Key).ToDictionary(p => p.Key, o => o.Value);
//降序
Dictionary<int, string> dic_desc = list.OrderByDescending(p => p.Key).ToDictionary(p => p.Key, o => o.Value);
边栏推荐
猜你喜欢
AWS SES 的监控和告警
Quantitative trading robot system development
【Attention 演变史】RNN的产生、架构、推广、问题(第一弹)
"WAIC 2022 · hackers marathon" two ants wealth competition invited you to fight!
hash和history路由的区别
How to monitor code cyclomatic complexity by refactoring indicators
Finger Vein Recognition-matlab
The book "The Essence of Alipay Experience Design", a record of knowledge related to testing
指静脉识别-matlab
基于YOLOV5行人跌倒检测实验
随机推荐
【最新资讯】2022下半年软考新增2个地区公布报名时间
c sqlite ... ...
电脑一键重装系统后连不上远程了?教你设置的方法
Infrared image filtering
密码学系列之:PEM和PKCS7,PKCS8,PKCS12
Defaced Fingerprint Recovery and Identification
SIGIR 2022 | 邻域建模Graph-Masked Transformer,显著提高CTR预测性能
Orthodontic MIA micro-implant anchorage technology China 10th anniversary exchange meeting was held in Shenyang
程序员如何在职场上少走弯路?
hash和history路由的区别
internship:改了需求
存储资源盘活系统助力新基建
六月 致 -.-- -..- -
The list of Kubernetes - watch mechanism
【Attention 演变史】RNN的产生、架构、推广、问题(第一弹)
华为WLAN技术:AP上线及相关模板的配置实验
Order of lds links
zynq 记录
量化交易机器人系统开发
【ASP.NET Core】 中间件