DatagridView concat strings
I have a datagridview with a column "name". There are about 50 rows with names. I would like to get all the names in one delimited sting, like this "David, john, Kim". Do I have to loop on all the rows in the grid for 开发者_开发技巧this or there is something cleaner without looping?
I'm using framework 4.0, c# winforms.
Thanks.
with help of LINQ:
string names = string.Join(", ", grid.Rows.OfType<DataGridViewRow>()
.Select(i => i.Cells["name"].Value.ToString()).ToArray())
精彩评论