当前位置:网站首页>对复杂字典Dictionary<T1,T2>排序问题
对复杂字典Dictionary<T1,T2>排序问题
2022-04-23 06:27:00 【大可山人】
//VoltageCount类(电压值对应的数量):
public class VoltageCount
{
public Double Voltage { get; set; } //电压值
public int CountV { get; set; } //电压值对应的数量
public VoltageCount()
{
}
public VoltageCount(Double voltage, int countV)
{
this.Voltage = voltage;
this.CountV = countV;
}
}
Dictionary<Point, VoltageCount>是将坐标点(绘制图像时使用)与VoltageCount数据对应的字典,目的用来在绘图对象(Graphics)中绘制电压值-数量的对应图像(如图中右侧部分)。
由于同时需要按数量大小进行排序,以便输出表格(如图中左边两表格,分别按数量降序排列),所以这里涉及字典排序问题。
Dictionary<Point, VoltageCount> result = new Dictionary<Point, VoltageCount>();
for (int i = 0; i <= 4; i++){
result.Add(listHeatPoints[i], dictionaryPointVoltageCount[listHeatPoints[i]]);
}
//排序
.ToDictionary(pair => pair.Key, pair => pair.Value);
版权声明
本文为[大可山人]所创,转载请带上原文链接,感谢
https://blog.csdn.net/johnsuna/article/details/75098376
边栏推荐
猜你喜欢
SAP pi / PO rfc2restful publishing RFC interface is a restful example (proxy indirect method)
Visualization Road (IX) detailed explanation of arrow class
js之预解析
ogldev-读书笔记
配置npm
Mysql 索引
keytool: command not found
基于NLP的软件安全研究(二)
页面实时显示当前时间
redis连接出错 ERR AUTH <password> called without any password configured for the default user.
随机推荐
5.SQL99标准:内连接和外连接
The difference and application of VR, AR and MR, as well as some implementation principles of AR technology
Implementation of MySQL persistence
SAP PI/PO rfc2RESTful 发布rfc接口为RESTful示例(Proxy间接法)
Reflection on the systematic design of Android audio and video caching mechanism
层次输出二叉树
斐波拉去动态规划
反思 | 事件总线的局限性,组件化开发流程中通信机制的设计与实现
How to judge whether a point is within a polygon (including complex polygons or a large number of polygons)
常用的DOS命令
State synchronization and frame synchronization
typescript字典的使用
FSM finite state machine
Methods of database query optimization
每日一题 | 曾被反转链表支配的恐惧
8.分页查询
异步的学习
配置npm
Simple random roll call lottery (written under JS)
h5本地存储数据sessionStorage、localStorage