I have some LINQ code that generates a list of strings, like this:
var data = from a in someOtherList orderby a select FunctionThatReturnsS
How about:
public static string Concat(this IEnumerable source) { StringBuilder sb = new StringBuilder(); foreach(string s in source) { sb.Append(s); } return sb.ToString(); }
and:
string s = data.Concat();
This then has no need for the extra ToList() / ToArray() step.
ToList()
ToArray()