How can I write a Linq expression (or anything else) that select item from a List and join them together ?
Example
IList data = new List<
You may be tempted to use Aggregate() if you're sticking with LINQ
IList data = new List();
data.Add(123);
data.Add(456);
var result = data.Select(x => x.ToString()).Aggregate((a,b) => a + "," + b);
I wouldn't recommend this because as I found out the hard way this will fail if the list contains zero items - or was it if it had only 1 item. I forget, but it fails all the same :-)
String.Join(...) is the best way
In the example above where the datatype is NOT a string you can do this :
string.Join(",", data.Select(x => x.ToString()).ToArray())