LINQ相当于IEnumerable的foreach <T>

大兔子大兔子 提交于 2020-07-28 18:31:02

问题:

I'd like to do the equivalent of the following in LINQ, but I can't figure out how: 我想在LINQ中执行以下操作,但是我不知道如何操作:

IEnumerable<Item> items = GetItems();
items.ForEach(i => i.DoStuff());

What is the real syntax? 真正的语法是什么?


解决方案:

参考一: https://stackoom.com/question/qB4/LINQ相当于IEnumerable的foreach-T
参考二: https://oldbug.net/q/qB4/LINQ-equivalent-of-foreach-for-IEnumerable-T
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!