当前位置:网站首页>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);
边栏推荐
猜你喜欢
Finger Vein Recognition-matlab
二叉树的遍历
Orthodontic MIA micro-implant anchorage technology China 10th anniversary exchange meeting was held in Shenyang
小波提取特征的VQ实现
How to monitor code cyclomatic complexity by refactoring indicators
openharmony代码框架初识(2)
IIC驱动OLED
SQL Server 遇到报错解决办法--更新中
How to promote the implementation of rural revitalization
如何推动乡村振兴的落地
随机推荐
六月 致 -.-- -..- -
如何使用 jMeter Parallel Controller - 并行控制器以及一些常犯的错误
致-.-- -..- -
量化交易机器人系统开发
图片延迟加载、预加载
Order of lds links
指静脉识别-matlab
JS手写JSON.stringify() (面试)
重构指标之如何监控代码圈复杂度
如何给MySQL添加自定义语法 ?
[Sql brush topic] Query information data--Day1
Chrome 开发者工具 performance 标签页的用法
Industrial CCD and CMOS camera
面试官:JVM运行时数据区包含哪几部分?作用是啥?
Exploration and Practice of Database Governance
【Attention演变史】翻译模型seq2seq (第二弹)
二叉树的遍历
String中的hashcode缓存以及HashMap中String作key的好处
如何让远在的老板看到你!----------来自财富中国网
June To -.-- -..- -