C#List去重
原创//正常是直接用Distinct去重
List list = new List() { 1, 1, 2, 2, 3, 4, 5};
list = list.Distinct().ToList();
//如果List中存储的是对象,则需要这样去重
List list = new List();
list = list.Where((x, i)=>list.FindIndex(z => z.Id == x.Id) == i).ToList();//我这里是根据Id去重 版权声明
所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除
相关文章
最新文章
- Backd:用社区投票替代融资背书的创业项目发现平台,能走多远? 49分钟前
- iPhone隐私不比Android强?牛津大学研究打破苹果安全神话 50分钟前
- Show HN: Dadgpt Open Source Halloween Costume 53分钟前
- Retroviral insertions contributed to divergence of human and chimpanzee brains 54分钟前
- Implications of Large-Scale Test-Time Compute 2小时前
- UK government sets out $800M of AI security funding 2小时前
- Xbox Turns Down Netflix $500M Offer 2小时前
- Show HN: Close the UI building AI agent loop with Protoshot 2小时前
- BBC interview with Ondřej Surý, Debian/Ubuntu PHP package maintainer 3小时前
- Talking with strangers is surprisingly informative 3小时前
itfan123

