当前位置:网站首页>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;
}边栏推荐
猜你喜欢

「 WAIC 2022 · 黑客马拉松」蚂蚁财富两大赛题邀你来战!

SIGIR 2022 | 邻域建模Graph-Masked Transformer,显著提高CTR预测性能

How to monitor code cyclomatic complexity by refactoring indicators

【Attention演变史】翻译模型seq2seq (第二弹)

视频目标检测

量化交易机器人系统开发

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

How to promote the implementation of rural revitalization

如何推动乡村振兴的落地

openharmony初体验(1)
随机推荐
Exploration and Practice of Database Governance
简易数据缓存层的建立
If it is test axi dma catch a few words here
笔记本WIFI无法上网(无Internet访问权限)
《支付宝体验设计精髓》一书,跟测试相关性知识记录
SQL Server 遇到报错解决办法--更新中
How to monitor code cyclomatic complexity by refactoring indicators
How to manually download and install SAP Fiori tools - Extension Pack for Visual Studio Code
[Latest Information] 2 new regions will announce the registration time for the soft exam in the second half of 2022
The establishment of simple data cache layer
LED的C语言应用程序
视频目标检测
v-model的使用
运维就业现状怎么样?技能要求高吗?
切换node版本和切换npm源工具
泰山OFFICE技术讲座:底纹、高亮、边框的关系
VQ Realization of Wavelet Extraction Features
【有奖征文】秋招特训,打造你的专属产品体验
Quantitative trading robot system development
IIC驱动OLED