Esempio n. 1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (ReferenceEquals(obj, this))
            {
                return(true);
            }

            if (obj.GetType() != GetType())
            {
                return(false);
            }

            PersonListe personListe = (PersonListe)obj;

            if (personListe.Count != Count)
            {
                return(false);
            }

            foreach (Person person in personListe)
            {
                if (!Contains(person))
                {
                    return(false);
                }
            }

            return(true);
        }
        public PersonListe GetDozentListe()
        {
            PersonListe dozentListe = new PersonListe();

            foreach (KursDozent kursDozent in this)
            {
                dozentListe.Add(kursDozent.Dozent);
            }

            return(dozentListe);
        }
Esempio n. 3
0
        public object Clone()
        {
            PersonListe personListe = new PersonListe();

            foreach (Person person in this)
            {
                if (person is Dozent dozent)
                {
                    personListe.Add((Dozent)dozent.Clone());
                }
                else if (person is Student student)
                {
                    personListe.Add((Student)student.Clone());
                }
            }

            return(personListe);
        }
Esempio n. 4
0
 public static void SetInstance(PersonListe personListe)
 {
     instance = personListe;
 }