1、写一个student类,字段有:name,age,对其进行扩展,实现可排序。(思路)
2、对上题进行扩展,实现可复制(克隆),clone深复制,浅复制,对student类进行扩展。(思路)

解决方案 »

  1.   

    HOHO,不难吧……HOHO//排序嘛就用 LINQ实现好了
    public class Student
    {
       public string Name{get;set;}
       public int Age{get;set;}   public Student Clone()
       {
           Student s = new Student();
           s.Name = this.Name;
           s.Age = this.Age;
       }
    }由于这个Student类里的成员都类似于值字段(string虽然是引用类型但操作方式类似于值类型。
      

  2.   


    //要排序的话,就这样。
    public IOrderedEnumerabled<Student> Sort(List<student> students)
    {
       return from c in students order by c.Name  select c;
    }容易吧?LINQ真是个漂亮的东西,效率什么的我不管,呵呵。用起来是真舒服。