コード例 #1
0
        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));
        }
コード例 #2
0
ファイル: MainProgram.cs プロジェクト: plwh/TelerikHomework
 static void Main()
 {
     Student firstStudent = new Student("Gosho","Goshev","Petrov",123456789,"22 Jump Street","0888888888","*****@*****.**",
                                    1,Specialty.ComputerScience,University.SofiaUniversity,Faculty.ComputerAndInformationScience);
     Console.WriteLine("First student info:\n"+ firstStudent);
     var secondStudent = firstStudent.Clone();
     Console.WriteLine("Second student info(clone of first):\n" + secondStudent);
 }
コード例 #3
0
ファイル: Student.cs プロジェクト: plwh/TelerikHomework
 public object Clone()
 {
     Student temp = new Student(this.FirstName, this.MiddleName, this.LastName,
                                this.SSN, this.Address, this.mobilePhone, this.Email,
                                this.Course, this.Specialty, this.University, this.Faculty);
     return temp;
 }