public static void ValidateDiscipline(Discipline discipline, Dictionary<Discipline, int> setOfDisciplines) { int value; if (setOfDisciplines.TryGetValue(discipline, out value)) { throw new ArgumentException("This discipline has already been assigned to this teacher. Cannot add the same discipline again."); } }
public void RemoveDiscipline(Discipline discipline) { int value; if (this.setOfDisciplines.TryGetValue(discipline, out value)) { this.setOfDisciplines.Remove(discipline); } else { throw new ArgumentException("This discipline has not been assigned to this teacher."); } }
public void AddDiscipline(Discipline discipline) { Validator.ValidateDiscipline(discipline, this.setOfDisciplines); this.setOfDisciplines.Add(discipline, 1); }
public void AddDiscipline(Discipline discipline) { Validator.ValidateDiscipline(discipline, this.setOfDisciplines); this.setOfDisciplines.Add(discipline, 1); }