var res = list.Where(p=> list2.Any(x=>x.Id == p.Id));
var count = res.Count();
var ids = res.Select(p=>p.Id).ToList(); 
 
此处需要申明的是如果是数组的话需要使用ToList()方法先转为List。

相关文章:

  • 2022-02-28
  • 2022-12-23
  • 2021-06-08
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案