Hey, its a really fun article and I guess very teaching to beginners (hence the fixes Patrick suggested are welcome). What I'd like to point out is that you could've went with LINQ's .Aggregate() fn, e.g. here you can see an exact 6 random chars variation to you code that does not reiterate with foreach but does everything in a single iteration:
You already imported and used it with using System.Linq;. What matters is that you do not need an additional iteration with .ToList() just to call .ForEach(), that is what .Aggregate() does for you in a single loop. Good idea for the next article.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey, its a really fun article and I guess very teaching to beginners (hence the fixes Patrick suggested are welcome). What I'd like to point out is that you could've went with LINQ's
.Aggregate()
fn, e.g. here you can see an exact 6 random chars variation to you code that does not reiterate with foreach but does everything in a single iteration:I am aware that I could have used LINQ, I thought about using LINQ. However it would not be very beginner friendly.
Additionally I might have a LINQ specific blog/tut planned ;)
You already imported and used it with
using System.Linq;
. What matters is that you do not need an additional iteration with.ToList()
just to call.ForEach()
, that is what.Aggregate()
does for you in a single loop. Good idea for the next article.