Exemple #1
0
        public new int CompareTo(object obj)
        {
            if (obj == null || obj.GetType() != GetType())
            {
                return(-1);
            }

            Student student = (Student)obj;
            int     matrikelnummerEqualRate = Matrikelnummer.CompareTo(student.Matrikelnummer);

            switch (matrikelnummerEqualRate)
            {
            case 0:
                int personEqualRate = base.CompareTo(obj);

                switch (personEqualRate)
                {
                case 0:
                    return(ECTS.CompareTo(student.ECTS));

                default:
                    return(personEqualRate);
                }

            default:
                return(matrikelnummerEqualRate);
            }
        }
Exemple #2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

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

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

            Student student = (Student)obj;

            return(base.Equals(student) &&
                   Matrikelnummer.Equals(student.Matrikelnummer) &&
                   ECTS.Equals(student.ECTS));
        }