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

No comments:

Post a Comment

About Me

My photo
simple and straight forward