IEnumerable to string

前端 未结 7 2131
既然无缘
既然无缘 2021-02-04 23:55

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         


        
7条回答
  •  囚心锁ツ
    2021-02-05 00:36

     String.Join(
          ",",
          _tbl.AsEnumerable()
              .Select(r => r.Field("ID").ToString())
              .ToArray())
    

提交回复
热议问题