Using Linq to concatenate strings

Posted by tags2k on Stack Overflow See other posts from Stack Overflow or by tags2k
Published on 2008-10-20T08:46:11Z Indexed on 2010/04/21 20:03 UTC
Read the original article Hit count: 299

Filed under:
|

What is the most efficient way to write the old-school:

StringBuilder sb = new StringBuilder();
if (strings.Count > 0)
{
    foreach (string s in strings)
    {
        sb.Append(s + ", ");
    }
    sb.Remove(sb.Length - 2, 2);
}
return sb.ToString();

...in Linq?

© Stack Overflow or respective owner

Related posts about string-concatenation

Related posts about LINQ