当前位置:网站首页>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;
}边栏推荐
猜你喜欢
随机推荐
Notepad++更改显示背景
c sqlite ... ...
AWS SES 的监控和告警
getBoundingClientRect
小波提取特征的VQ实现
视频目标检测
一些性能测试的要点
前3名突然变了,揭秘 7 月编程语言最新排行榜
Video Object Detection
To -.-- -..- -
七夕福利!中奖名单:书籍免费送!
[Sql刷题篇] 查询信息数据--Day1
really time ntp服务启动命令
如何手动下载并安装 Visual Studio Code 的 SAP Fiori tools - Extension Pack
Finger Vein Recognition-matlab
Finished product upgrade program
QCustomPlot 坐标轴间隔显示刻度标签
二叉树的遍历
存储资源盘活系统助力新基建
Storage resource activation system to help new infrastructure









