A simple little linq values transformer - Digital Tool Factory blog A simple little linq values transformer - Digital Tool Factory blog

A simple little linq values transformer

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

 

Leave a Reply

Your email address will not be published. Required fields are marked *






Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.