当前位置:网站首页>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;
}
边栏推荐
- Highlights of some performance tests
- 哈佛架构 VS 冯·诺依曼架构
- Force KouTi (5), the longest text string back
- Orthodontic MIA micro-implant anchorage technology China 10th anniversary exchange meeting was held in Shenyang
- getBoundingClientRect
- VQ Realization of Wavelet Extraction Features
- Use "green computing" technology to promote sustainable development of computing power
- QT 小知识随记
- visual studio 与 visual studio code
- 「 WAIC 2022 · 黑客马拉松」蚂蚁财富两大赛题邀你来战!
猜你喜欢
随机推荐
用“绿色计算“技术推动算力可持续发展
June To -.-- -..- -
性能测试流程
面试官:JVM运行时数据区包含哪几部分?作用是啥?
Use "green computing" technology to promote sustainable development of computing power
Kubernetes之list-watch机制
SQL Server 遇到报错解决办法--更新中
基于HDF的LED驱动程序开发(2)
The difference between Client Side Cache and Server Side Cache
笔记本WIFI无法上网(无Internet访问权限)
SAP UI5 的初始化过程
02 ts 变量定义,类型
How to manually download and install SAP Fiori tools - Extension Pack for Visual Studio Code
"WAIC 2022 · hackers marathon" two ants wealth competition invited you to fight!
[Awards for Essays] Autumn recruitment special training to create your exclusive product experience
重构指标之如何监控代码圈复杂度
量化交易机器人系统开发
5G NR 笔记记录
正畸MIA微种植体支抗技术中国10周年交流会在沈举办
Pedestrian fall detection experiment based on YOLOV5