新巴黎中文社区,姜玉阳图片,十二影城12yc
本文实例讲述了c#针对xml文件转化dictionary的方法。分享给大家供大家参考。具体实现方法如下:
下面是xml文件:
下面是相关的获取方法:
dictionary<string, string> pdic = new dictionary<string, string>();
var info = from t in xd.root.descendants("国土局").where(p => p.element("code").value == p_shixiancode) select new { name = t.element("name").value, code = t.element("code").value, shouli = t.element("受理").value, telephone = t.element("受理").attribute("telephone").value, shenhe = t.element("审核").value, personid = t.element("审核").attribute("personid").value, shending = t.element("审定").value, deptid = t.element("deptid").value, belongsystem = t.element("belongsystem").value, servicecode = t.element("servicecode").value };
foreach (var item in info)
{
pdic.add("name", item.name);
pdic.add("code", item.code);
pdic.add("shouliperson", item.shouli);
pdic.add("telephone", item.telephone);
pdic.add("shenheperson", item.shenhe);
pdic.add("shenhepersonid", item.personid);
pdic.add("shendingperson", item.shending);
pdic.add("deptid", item.deptid);
pdic.add("belongsystem", item.belongsystem);
pdic.add("servicecode", item.servicecode);
}
return pdic;
}
就这样啦就可以了,直接调用该方法就可以啦
希望本文所述对大家的c#程序设计有所帮助。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
C#实现获取本地内网(局域网)和外网(公网)IP地址的方法分析
浅谈Visual Studio 2019 Vue项目的目录结构
Visual Studio 2019配置vue项目的图文教程详解
网友评论