Пример #1
0
        static void Main()
        {
            Student testSubject = new Student("Ivan", "Zhelyazkov", "Todorov", 8911068523, "Sofia", 0886889900, "*****@*****.**", 3, 
                Specialty.Law, University.SofiaUnivercity, Faculty.Legal);

            Student newTestSubject = new Student("Ivan", "Zhelyazkov", "Todorov", 8911068523, "Sofia", 0886889900, "*****@*****.**", 3,
                Specialty.Law, University.SofiaUnivercity, Faculty.Legal); ;

            Console.WriteLine(testSubject.ToString());
            Console.WriteLine(newTestSubject);

            if (testSubject.Equals(newTestSubject))
            {
                Console.WriteLine("TestSubject EQUALS NewTestSubject");
            }
            else
            {
                Console.WriteLine("TestSubject DOES NOT equal NewTestSubject");
            }

            if (testSubject == newTestSubject)
            {
                Console.WriteLine("TestSubject == NewTestSubject");
            }
            else if (testSubject != newTestSubject)
            {
                Console.WriteLine("TestSubject != NewTestSubject");
            }

            Console.WriteLine("The hash code is: {0}", testSubject.GetHashCode());
        }
Пример #2
0
        static void Main()
        {
            Student testSubject = new Student("Ivan", "Zhelyazkov", "Todorov", 8911068523, "Sofia", 0886889900, "*****@*****.**", 3, 
                Specialty.Law, University.SofiaUnivercity, Faculty.Legal);

            Student cloneSubject = testSubject.Clone();

            Console.WriteLine(cloneSubject);
            cloneSubject.FirstName = "Daniel";
            Console.WriteLine(cloneSubject);
            Console.WriteLine(testSubject);
        }