I am trying to convert XML to List
<School>
<Student>
<Id>2</Id>
<Name>dummy</Name>
<Section>12</Section>
</Student>
<Student>
<Id>3</Id>
<Name>dummy</Name>
<Section>11</Section>
</Student>
</School>
I tried few things using LINQ and am not so clear on proceeding.
dox.Descendants("Student").Select(d=>d.Value).ToList();
Am getting count 2 but values are like 2dummy12 3dummy11
Is it possible to convert the above XML to a generic List of type Student which has Id,Name and Section Properties ?
What is the best way I can implement this ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…