How can i deserialize this xml using Linq?
I want to create List
1
Showing the above answers in LINQ method syntax
Descendants:
var steps = xml.Descendants("Step").Select(step => new
{
Id = (int)step.Element("ID"),
Name = step.Element("Name").Value,
Description = step.Element("Description").Value
});
Elements:
var steps2 = xml.Element("MySteps").Elements("Step").Select(step => new
{
Id = (int)step.Element("ID"),
Name = step.Element("Name").Value,
Description = step.Element("Description").Value
});