Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How to assign integer value to the elements of an existing List in C#?

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