john spurlock 2007


“I have a list of Foo objects, each having a Description() method that returns a string. I need to concatenate all the non-empty descriptions, inserting newlines between them.”

In C# 3.0:

“\n”.Join(from x in mylist where x.Description != “” select x.Description)

via