I'm doing a CRUD with students and I'm trying to find a student with LINQ but I don't want to use a list so I want to work directly on the XML file. How can I do that?
My XML file is:
<?xml version="1.0"?>
<ArrayOfStudent xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Student>
<IDstudent>56</IDstudent>
<Name>da</Name>
<Surname>he</Surname>
</Student>
</ArrayOfStudent>
It works loading my XML into a list and do LINQ but I want to do it in a efficient way.
public Student FindStudent(string id)
{
List<Student> LStudent = GetAll();
Student student = LStudent.Where(e => e.IDstudent == id).FirstOrDefault();
return student;
}