Executing a certain action for all elements in an Enumerable

前端 未结 10 1752
春和景丽
春和景丽 2020-12-14 13:49

I have an Enumerable and am looking for a method that allows me to execute an action for each element, kind of like Select but then for si

10条回答
  •  萌比男神i
    2020-12-14 14:32

    Well, you can also use the standard foreach keyword, just format it into a oneliner:

    foreach(var n in Names.Where(blahblah)) DoStuff(n);
    

    Sorry, thought this option deserves to be here :)

提交回复
热议问题