LINQ to XML - Query multiple elements and attributes


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var loginQuery = from results in xdoc.Descendants("IODATA")
  2. select new
  3. {
  4. Name = results.Element("USER").Attribute("fullname").Value,
  5. ReturnedLoginGuid = results.Element("LOGIN").Attribute("guid").Value,
  6. ReturnedProjects = results.Element("USER").Element("LASTMODULES").Descendants("MODULE")
  7. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.