c# recursion method for arraylist : Good evening guys, I got a little bit stuck in recursive sum calculation. I have a container class of Students and all students are in object class Student(student has his name ,last name ... and his grades).I am saving student's grades in arraylist and I want a recursive method in container class wich could calculate those grades inside the ArrayList.I know how to do it in iterative way , but not sure about recursive version of it.

**Student class**

    class Student
    {
        public ArrayList grades = new ArrayList();

        public Student(ArrayList grades)
        {
            this.grades = grades;
        }
    }


**Students class(Container)**

    class Students
    {
        private Student[] studentOb{ get; set; }
        public int containerNumber{ get; private set; }
    }
    
    public Students(int size)
        {
            studentOb = new Student[size];
        }

        public void AddElement(Student info)
        {
            studentOb[containerNumber++] = info;
        }

        public Student TakeElement(int index)
        {
            return studentOb[index];
        }

        //this is where I am trying to build that Sum method, and yeah my code is just nonsense
        public int Sum(ArrayList collection)
        {
            int ret = collection.Count;

            foreach (ArrayList newList in collection)
            {
                ret += Sum(newList)
            }
        }