The request Linqwill not be processed until you convert it to Enumarablewith ToList(), ToArray()etc.
And by the way, the equivalent of your operator foreachlooks something like this:
strs.ForEach (doSomething);
Strike>
strs.ToList().ForEach(doSomething);
or
Array.ForEach(strs, doSomething);
source
share