新建一个Test类。。。用于排序的类

 Test
{
    public int intId{get;set;}

    
public string strTime{get;set;}
}

 新建一个TestSort类继承IComparer<Test>接口,为List<Test>添加排序规则!

    }

 调用

List<Test> list = new List<Test>();

list.Sort(new TestSort());


这样就可以为List<T>进行对id大小的排序,是从小到大的排序。

相关文章:

  • 2022-02-01
  • 2021-11-17
  • 2021-08-26
  • 2021-08-13
  • 2022-01-11
  • 2022-12-23
  • 2022-02-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案