IEnumerable to string

user160677 picture user160677 · Aug 5, 2010 · Viewed 81k times · Source

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,101

How can i rewrite the following to get a single string

var _values = _tbl.AsEnumerable().Select(x => x);

Answer

Winston Smith picture Winston Smith · Aug 5, 2010
var singleString = string.Join(",", _values.ToArray() );