Somehow I’ve never actually used this keyword before, but as I gradually shift over to functional programming I came across the ForEach linq statement – for example
listOfObjects.ForEach(x => x.BodyText = x.BodyText.Replace(“,”,”, “));
And bam – all of the body text is replaced without having to loop through the enumerable. Rather nice. A simple little statement, but one that I’ve never really had the change to use before.
||Written By Steve French|