Gee Batol

Gee Batol

  • NA
  • 9
  • 14.1k

A function to populate LIST collection

Jan 9 2012 10:57 PM

Hi,

Coming from a primitive language like ansi-C,I'm new to C# so I really need your help. How do I write a function
that would loop through a given dataset and populate the list of courses tied up to the student,
then loop through the subjects tied up to the given course?

StudentName       Age         Courses                 SubjectsList
Prasad Singh       23         Bachelor of Arts        Subject 1
Prasad Singh       23         Bachelor of Business    Subject 11
Prasad Singh       23         Bachelor of Arts        Subject 2
Prasad Singh       23         Bachelor of Business    Subject 22
Nand Sawadi        42         Bachelor of Arts        Subject 8
Nand Sawadi        42         Bachelor of Engg        Subject 9
Rajaned Motupah    19         Diploma in Math         Subject 10
Rajaned Motupah    19         Diploma in Press        Subject 11
Rajaned Motupah    19         Diploma in Tourism      Subject 142
Rajaned Motupah    19         Diploma in Tourism      Subject 115
Mayar Karan        22         Certificate in English  Subject 25


Class Student
{

String Name {get;set;}
Integer Age {get;set;}
List<of String> Courses {get; set;}

??? should I define another LIST here for subjects??
}


Thanks in advance for the help.


Answers (5)