The problem:
I want to allow an administrator (user) to create a list of teachers, each
teacher in turn has a list of classes, each class has a list of students.
There's an article at http://aspalliance.com/721 that describes making
classes for the Student and the StudentList, but I'm wondering how to make
classes that are collections of the other classes, ie a ClassList that holds
the StudentList class and a TeacherList class that holds the ClassList class.
TeacherList-->ClassList-->StudentList-->Student
What is the approach to use to make a custom object that could handle this
nesting?
The article mentioned above has a StudentList Class that inherits from
IEnumerable and uses a Hastable to hold the Student objects that are made up
of simple data types. I tried making classes in a similar fashion for the
ClassList and StudentList collections, but I'm having casting errors, so I'm
not sure that this is the correct approach or my implementation is not
correct.
Anyone have any ideas or suggestions as to how to nest collections like
this? or another approach to accomplish the same thing? If you want to see
the code I've tried, I can post it.
Thanks,
Paul