This blog is dedicated to my experiences in programming. Contributors are welcome, please email me at jhelyn.suan@gmail.com
Monday, August 24, 2009
XML and LINQ
How to query in C# using LINQ
XDocument xmlFile = XDocument.Load(filename);
var xt = from y in xmlFile.Descendants("Users").Elements("details")
where y.Attribute("userName").Value == x
select new TempClass
{
Name = y.Element("userdetails").Attribute("userFirstName").Value
};
Download Sample Code Here
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment