Join collection of objects into comma-separated string

前端 未结 11 1348
无人共我
无人共我 2020-12-07 19:22

In many places in our code we have collections of objects, from which we need to create a comma-separated list. The type of collection varies: it may be a DataTable from whi

11条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-07 19:54

    In .NET 4 you can just do string.Join(", ", table.Rows.Select(r => r["title"]))

提交回复
热议问题