有时可能需要需要获取一个List中符合某条件的项的index集合,可以使用如下Linq语句:

 

var query = source.Select((value, index) => new { value, index }).Where(x => x.value => Condition(value)).Select(x => x.index);

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-24
  • 2021-10-11
  • 2021-12-21
  • 2021-09-28
猜你喜欢
  • 2021-12-02
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2023-03-28
相关资源
相似解决方案