예제 #1
0
 public void AddPeople(People newPerson)
 {
     foreach (var person in this.people)
     {
         if(newPerson is Student && person is Student)
         {
             var newStudent = newPerson as Student;
             var student = person as Student;
             if(student.UniqueClassNumber == newStudent.UniqueClassNumber)
             {
                 throw new ArgumentException("Class numbers of students must be UNIQUE!");
             }
         }
     }
     this.people.Add(newPerson);
 }
예제 #2
0
 public void RemovePeople(People oldPerson)
 {
     this.people.Remove(oldPerson);
 }