XmlDocument doc = new XmlDocument(); doc.Load(@"C:\Sampledata.xml"); var data = doc.Element("testes").Elements("teste"); Dictionary<string, string> hash = new Dictionary<string, string>(); var result = from d in data select new Dictionary<string, string>() { { "sernum", (string)d.Attribute("sernum") }, { "rectime", (string)d.Attribute("rectime") }, { "area", (string)d.Attribute("area") }, { "machine", (string)d.Attribute("machine") }, {"cell",(string)d.Attribute("cell")} }; foreach (var item in result) { foreach (var y in item) { hash.Add(y.Key, y.Value); } }
Element()
Elements()
XContainer
XmlDocument
XDocument
Sysstem.XML.LINQ<br /> Sysstem.LINQ
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)