初学linq to xml,很方便
string path = ch.GetConfigFile(
"")+
"SpeedDial.xml";
var sdDoc =
XDocument.Load(path);
//linq to xml
var query =
from resource
in sdDoc.Descendants(
"item")
where (
int)resource.Attribute(
"parentId") ==
0
select new
{
Sn=resource.Element(
"sn").Value,
Name=resource.Element(
"name").Value,
Icon=resource.Element(
"icon").Value
};
转载于:https://www.cnblogs.com/siyunianhua/p/8302150.html
相关资源:2008.精通LINQ数据访问技术pdf及源码