static void Main(string[] args)
        {
            Student student1 = new Student();

            student1.FirstName  = "Pesho";
            student1.MiddleName = "Peshev";
            student1.LastName   = "Peshev";
            student1.SSN        = 12345;
            student1.University = University.SofiaUniversity;

            Student student2 = new Student();

            student2.FirstName  = "Pesho";
            student2.MiddleName = "Peshev";
            student2.LastName   = "Peshev";
            student2.SSN        = 12345;
            student2.University = University.SofiaUniversity;

            Console.WriteLine("TEST STUDENT");
            Console.WriteLine(student1.Equals(student2));
            Console.WriteLine(student2.GetHashCode());
            Console.WriteLine(student2.ToString());
            Console.WriteLine(student1 == student2);
            Console.WriteLine(student1 != student2);
            Console.WriteLine();
            Console.WriteLine("TEST CLONE");
            Student student3 = new Student();

            student3 = student2.Clone();
            Console.WriteLine(student3);
            Console.WriteLine();
            Console.WriteLine("TEST COMPARE");
            Console.WriteLine(student3.CompareTo(student1));
        }
Exemplo n.º 2
0
        public static void Main()
        {
            Student nikola = new Student("Nikola", "Ivanov", "Nikolov", "13444",
                                         "Sofia", "0888888888", "*****@*****.**", 3,
                                         Specialty.CivilEngineering, Faculty.Civil, University.UACEG);

            Console.WriteLine(nikola);

            Student clone = nikola;

            Console.WriteLine(clone);
            Console.WriteLine(nikola == clone);

            var copy = nikola.Clone();

            Console.WriteLine(nikola == copy);
            Console.WriteLine(nikola != copy);
            Console.WriteLine(nikola.GetHashCode());
            //Console.WriteLine(nikola.Equals(copy));

            Student tester = new Student("Momchil", "Ivanov", "Nikolov", "13444",
                                         "Sofia", "0888888888", "*****@*****.**", 3,
                                         Specialty.CivilEngineering, Faculty.Civil, University.UACEG);

            Console.WriteLine(tester);
            Console.WriteLine("Compare 2 students: " + nikola.CompareTo(tester) + "!");
        }
        static void Main(string[] args)
        {
            Student student1 = new Student();
            student1.FirstName = "Pesho";
            student1.MiddleName = "Peshev";
            student1.LastName = "Peshev";
            student1.SSN = 12345;
            student1.University = University.SofiaUniversity;

            Student student2 = new Student();
            student2.FirstName = "Pesho";
            student2.MiddleName = "Peshev";
            student2.LastName = "Peshev";
            student2.SSN = 12345;
            student2.University = University.SofiaUniversity;

            Console.WriteLine("TEST STUDENT");
            Console.WriteLine(student1.Equals(student2));
            Console.WriteLine(student2.GetHashCode());
            Console.WriteLine(student2.ToString());
            Console.WriteLine(student1 == student2);
            Console.WriteLine(student1 != student2);
            Console.WriteLine();
            Console.WriteLine("TEST CLONE");
            Student student3 = new Student();
            student3 = student2.Clone();
            Console.WriteLine(student3);
            Console.WriteLine();
            Console.WriteLine("TEST COMPARE");
            Console.WriteLine(student3.CompareTo(student1));
        }