I have a DataTable that returns
IDs
,1
,2
,3
,4
,5
,100
,101
I want to convert this to single string value, i.e:
,1,2,3,4,5,100
You can cheat with this:
String output = "";
_tbl.AsEnumerable().Select(x => output += x).ToArray();
// output now contains concatenated string
Note ToArray()
or similar is needed to force the query to execute.
Another option is
String output = String.Concat(_tbl.AsEnumerable().Select(x=>x).ToArray());