February 24th, 2010Small LINQ Trick for Converting List<String> to String Text List
Here is a shorthand way for converting a list of strings defined as follows:
List<string> strings = new List<string> { "a","b","c" };
To something that looks like:
“a:b:c:”
Here is the trick using the foreach syntax:
var stringBuilder = new StringBuilder(); strings.ForEach(a=>stringBuilder.AppendFormat("{0}:",a));









February 25th, 2010 at 1:00 am
String.Join(“:”, strings.ToArray()) + “:” ?
February 25th, 2010 at 8:09 am
You can also use the .Aggregate() Linq function, which can be used for accumulating any data type (not just strings).
February 26th, 2010 at 1:49 am
[...] Small LINQ Trick for Converting List to String Text List (Peter Kellner) [...]
June 3rd, 2010 at 4:31 pm
[...] Small LINQ Trick for Converting List to String Text List (Peter Kellner) [...]
April 13th, 2011 at 12:41 pm
After I initially commented I clicked the -Notify me when new feedback are added- checkbox and now every time a remark is added I get four emails with the same comment. Is there any means you may remove me from that service? Thanks!
August 8th, 2011 at 6:25 pm
If you want to start to see the mind-blowing article together with real facts and statistics, it is really huge has an effect on upon viewers and i also admire your writing ability of the publisher.
August 8th, 2011 at 6:53 pm
Every one of the posts tend to be fully helpful inside them for hours good styles. I enjoy call at your blog again and again it’s actually boost my knowledge. Just awesome post.
January 17th, 2012 at 6:12 pm
I’m thrilled to find this kind of submit very helpful for me, as it contains large amount of data. I would rather browse the good quality articles which thing I discovered inside you article. Thank you for expressing!