Is there any possible way to do that? I know we can use Dictionary<> instead of list but I need to use list. I have created a class CustomDataList:
private List<string> students = new List<string>();
public List<string> GetList()
{
return students;
}
public void AddStudent(string student)
{
students.Add(student);
}
And I have this code inside the Main method:
CustomDataList customDataList = new CustomDataList();
//Add(element)
customDataList.AddStudent("Jenny");
customDataList.AddStudent("Loren");
customDataList.AddStudent("Martin");
customDataList.AddStudent("Hannah");
customDataList.AddStudent("Ariana");
customDataList.AddStudent("Nikkita");
How can I assign int values to the elements of the list(more specifically I want to give scores to each student) in order to add some other required methods GetMaxElement() and GetMinElement()
Comments
Post a Comment