当前位置:网站首页>C#将对象转换为Dictionary字典集合
C#将对象转换为Dictionary字典集合
2022-08-04 19:44:00 【幕尘枫】
/// <summary>
/// 将对象转换为字典集合
/// </summary>
/// <param name="zone">对象</param>
/// <returns></returns>
public Dictionary<string, string> ObjectToMap(Zone zone)
{
Dictionary<string, string> map = new Dictionary<string, string>();
PropertyInfo[] list = zone.GetType().GetProperties();
foreach (PropertyInfo p in list)
{
//Console.WriteLine("键:" + p.Name + ",值:" + p.GetValue(zone, null));
map.Add(p.Name, p.GetValue(zone, null).ToString());
}
return map;
}边栏推荐
猜你喜欢

openharmony初体验(1)

PG网络传输安全SSL介绍及使用示例

哈佛架构 VS 冯·诺依曼架构

Quantitative trading robot system development

入门:人脸专集1 | 级联卷积神经网络用于人脸检测(文末福利)

高效目标检测:动态候选较大程度提升检测精度(附论文下载)

VQ Realization of Wavelet Extraction Features
Force KouTi (5), the longest text string back

Use "green computing" technology to promote sustainable development of computing power

TritonVM——基于Recursive STARK的虚拟机
随机推荐
SIGIR 2022 | 邻域建模Graph-Masked Transformer,显著提高CTR预测性能
基于HDF的LED驱动程序开发(2)
力扣题(5)—— 最长回文子串
密码学系列之:PEM和PKCS7,PKCS8,PKCS12
Differences in the working mechanism between SAP E-commerce Cloud Accelerator and Spartacus UI
高效目标检测:动态候选较大程度提升检测精度(附论文下载)
[Sql刷题篇] 查询信息数据--Day1
基于YOLOV5行人跌倒检测实验
How to manually download and install SAP Fiori tools - Extension Pack for Visual Studio Code
T+Cloud:构建新型生意社交网络和营销关系的“智公司”
nr part calculation
用“绿色计算“技术推动算力可持续发展
元国度链游系统开发
七夕福利!中奖名单:书籍免费送!
电脑一键重装系统内存完整性无法打开怎么办
如果是测试 axi dma抓数的话 看这里
Quantitative trading robot system development
PostgreSQL的 SPI_接口函数
SQL Server 遇到报错解决办法--更新中
Infrared image filtering