LINQ equivalent of foreach for IEnumerable

后端 未结 22 2298
夕颜
夕颜 2020-11-21 22:54

I\'d like to do the equivalent of the following in LINQ, but I can\'t figure out how:

IEnumerable items = GetItems();
items.ForEach(i => i.DoS         


        
22条回答
  •  走了就别回头了
    2020-11-21 23:24

    MoreLinq has IEnumerable.ForEach and a ton of other useful extensions. It's probably not worth taking the dependency just for ForEach, but there's a lot of useful stuff in there.

    https://www.nuget.org/packages/morelinq/

    https://github.com/morelinq/MoreLINQ

提交回复
热议问题