I am having a Node
public class Node
{
public Node(Pupil pupil)
{
Data = pupil;
Next = null;
}
public Pupil Data { get; set; }
public Node Next { get; set; }
}
which holds the date of birth of a student. I insert objects to the list like this
public void Insert(Pupil pupil)
{
if (_head == null)
{
_head = new Node(pupil);
return;
}
Node current = _head;
while (current.Next != null)
{
current = current.Next;
}
current.Next = new Node(pupil);
}
But now i have the problem to sort the pupils by date of birth (pupil.DateOfBirth). Since I am new to Lists etc. I dont have an idea how to do this. Since corona is here we have to basically teach it ourselves in university.
Help would be really appreciated.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…