Esempio n. 1
0
        static void Main()
        {
            var she = new Student("She", "middleShe", "Mrs.She", "45765", "Sofia Al.Malinov",
                "0888456788", "*****@*****.**", "C#", SpecialityType.Informatics, UniversityType.SofiaUniversity, FacultyType.Maths);

            var he = new Student("He", "middleHe", "Mr.He", "456765", "Sofia Al.Malinov",
               "0888434788", "*****@*****.**", "C#", SpecialityType.Authomatics, UniversityType.TechUniversity, FacultyType.Tech);

            var copyHer = she.Clone();
            copyHer = copyHer as Student;
            Console.WriteLine($"Copied her:");
            Console.WriteLine(copyHer);

            Console.WriteLine(she.ToString());
            Console.WriteLine(he.ToString());

            var isTheSame=she==he?"They are together :D":"They are in break.";
            Console.WriteLine(isTheSame);

            var code = she.GetHashCode() == he.GetHashCode() ? "The same codes." : "Different codes.";
            Console.WriteLine(code);

            var compared = she.CompareTo(he);
            Console.WriteLine($"Compared ? ==> {compared}");
        }
Esempio n. 2
0
        public int CompareTo(Student another)
        {
            var output = -1;
            if (this.firstName.Length > another.firstName.Length && this.ssn.Length < another.ssn.Length)
            {
                return 1;
            }

            return output;
        }