当前位置:网站首页>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);边栏推荐
猜你喜欢
随机推荐
Spark提交参数说明和常见优化
awk statistical average max min
openharmony初体验(1)
JS手写JSON.stringify() (面试)
视频目标检测
QCustomPlot 坐标轴间隔显示刻度标签
nr部分计算
泰山OFFICE技术讲座:底纹、高亮、边框的关系
PostgreSQL的 SPI_接口函数
华为企业组网实例:VRRP+MSTP典型组网配置
SIGIR 2022 | 邻域建模Graph-Masked Transformer,显著提高CTR预测性能
Query the published version records of the APP Store
Go学习笔记(篇一)配置Go开发环境
《支付宝体验设计精髓》一书,跟测试相关性知识记录
[Latest Information] 2 new regions will announce the registration time for the soft exam in the second half of 2022
完善的交叉编译环境记录 peta 生成的shell 脚本
Openharmony first experience (1)
Polygon zkEVM 基本概念
Kubernetes之list-watch机制
简易数据缓存层的建立









