public virtual object DeepCopy() { Examp Ex = new Examp(); Ex.Subject = this.Subject; Ex.Rating = this.Rating; Ex.ExampDate = this.ExampDate; return(Ex); }
public void AddDefault(int namber) { StudentListHandlerEventArgs arg = new StudentListHandlerEventArgs(); Student stud1 = new Student(); int i = 0; int count = Student.Count(); while (i < namber) { stud1 = new Student(); stud1._DateStudent = new Person("Default" + i, "Default" + i, DateTime.MinValue); stud1._Education = Education.Master; stud1._NamberGrup = 101 + i; Examp Ex1 = new Examp("Examp" + i, 5, DateTime.MinValue); Examp Ex2 = new Examp("Examp" + i * 2, 5, DateTime.MinValue); Test Ts1 = new Test("Test" + i, true); Test Ts2 = new Test("Test" + i * 2, true); Test Ts3 = new Test("Test" + i * 3, true); stud1._InformatoinExamp.Add(Ex1); stud1._InformatoinExamp.Add(Ex2); stud1._InformationTest.Add(Ts1); stud1._InformationTest.Add(Ts2); stud1._InformationTest.Add(Ts3); Student.Add(stud1); i++; arg.student = "Student"; arg.TypeChangeCollections = "AddDefault"; arg.ObjectChang = Student[Student.Count - 1]; if (StudentCountChanged != null) { StudentCountChanged(this, arg); } } }
static void Main(string[] args) { StudentCollection stud_ob1 = new StudentCollection(); StudentCollection stud_ob2 = new StudentCollection(); Journal ob1 = new Journal(); Journal ob2 = new Journal(); stud_ob1.StudentCountChanged += ob1.Stud_StudentCountChanged; stud_ob1.StudentReferenceChanged += ob1.Stud_StudentReferenceChanged; stud_ob1.StudentCountChanged += ob2.Stud_StudentCountChanged; stud_ob1.StudentReferenceChanged += ob2.Stud_StudentReferenceChanged; stud_ob2.StudentCountChanged += ob2.Stud_StudentCountChanged; stud_ob2.StudentReferenceChanged += ob2.Stud_StudentReferenceChanged; Student stud1 = new Student(); stud1._DateStudent = new Person("CCCC", "uuu", new DateTime(1997, 5, 21)); stud1._Education = Education.SecondEducation; stud1._NamberGrup = 402; Examp Ex1 = new Examp("Matan", 3, new DateTime(2017, 12, 11)); Examp Ex2 = new Examp("Programing", 5, new DateTime(2017, 12, 24)); Test Ts1 = new Test("DiscritLogic", true); Test Ts2 = new Test("MatLogic", true); Test Ts3 = new Test("Algebra", false); stud1._InformatoinExamp.Add(Ex1); stud1._InformatoinExamp.Add(Ex2); stud1._InformationTest.Add(Ts1); stud1._InformationTest.Add(Ts2); stud1._InformationTest.Add(Ts3); stud_ob1.AddStudent(stud1); stud_ob1.AddDefault(10); stud_ob1.Remove(1); stud_ob1.Remove(3); stud_ob1[1] = stud1; stud1 = new Student(); stud1._DateStudent = new Person("CCCC", "uuu", new DateTime(1997, 5, 21)); stud1._Education = Education.SecondEducation; stud1._NamberGrup = 402; Ex1 = new Examp("Matan", 3, new DateTime(2017, 12, 11)); Ex2 = new Examp("Programing", 5, new DateTime(2017, 12, 24)); Ts1 = new Test("DiscritLogic", true); Ts2 = new Test("MatLogic", true); Ts3 = new Test("Algebra", false); stud1._InformatoinExamp.Add(Ex1); stud1._InformatoinExamp.Add(Ex2); stud1._InformationTest.Add(Ts1); stud1._InformationTest.Add(Ts2); stud1._InformationTest.Add(Ts3); stud_ob2.AddStudent(stud1); stud_ob2.AddDefault(7); stud_ob2.Remove(2); stud_ob2.Remove(5); stud_ob2[2] = stud1; Console.WriteLine("----------------------------------1"); Console.WriteLine(ob1.ToString()); Console.WriteLine("----------------------------------2"); Console.WriteLine(ob2.ToString()); Console.ReadLine(); }