I already know that the following code doesn’t work
string s = "";
someEnumerable.Select(x => s+= x);
What I want to know is if there’s some other way (preferably using linq) of get the above behavior without using cyclic statements such as “for” or “foreach”.
Thanks.
The acc, is the accumulator (what we’ve aggrigated/combined so far), next is the next element enumerated over. So, here i take what we’ve got so far (initially an empty string), and return the string with the next element appended.