Ejemplo n.º 1
0
 public void AddStudent(string course, Student student)
 {
     if (this.courses.ContainsKey(course))
     {
         this.courses[course].Add(student);
     }
     else
     {
         this.courses[course] = new SortedSet<Student>();
         this.courses[course].Add(student);
     }
 }
Ejemplo n.º 2
0
        private static Courses GetCoursesFromFile(string path)
        {
            var reader = new StreamReader(path);
            var courses = new Courses();

            while (!reader.EndOfStream)
            {
                var lineParams = reader.ReadLine().Split('|').Select(x => x.Trim()).ToList();
                var courseName = lineParams[2];
                var student = new Student(lineParams[0], lineParams[1]);

                courses.AddStudent(courseName, student);
            }

            return courses;
        }