To use LINQ to XML you will need to import a two of namespaces.
using System.Linq; using System.Xml.Linq; private void StudentsLoad() { var xElem = XElement.Load(@"Student.xml"); var students = from prod in xElem.Descendants("Student") orderby prod.Element("StudentName").Value select prod.Element("StudentName").Value; lstStudents.DataContext = students; }
0 comments
Post a Comment