예제 #1
0
 public object Clone()
 {
     ClassRoom k = new ClassRoom(_students.Length);
     foreach (var student in this)
     {
          k.AddStudent((Student)((Student)student).Clone());
     }
     k.Name = this.Name;
     return k;
 }
예제 #2
0
 static void Main(string[] args)
 {
     ClassRoom temp = new ClassRoom(3);
     Student one = new Student();
     one.Id = 1343;
     temp.AddStudent(one);
     Student two = new Student();
     two.Id = 4532;
     temp.AddStudent(two);
     Student free = new Student();
     free.Id = 6734;
     temp.AddStudent(free);
     foreach (var j in temp)
     {
         Console.WriteLine(((Student)j).Id);
     }
 }