Actually,I have a DataTable
containing 2000 rows with a ColumnName
EMAIL
.
Now,I want to show all emails from the DataTable
and adding them to a TextBox
by separating with a ,
.
I am achieving this by a for
loop,But,it is taking a long time.
Actually,I have used for getting the ColumnNames
:
string[] columnNames1 = (from dc in table.Columns.Cast<DataColumn>()
select dc.ColumnName).ToArray();
Is there any thing like this,for joining
all rows data to a single string ?
var text = string.Join(",", table.AsEnumerable()
.Select(x=>x["EMAIL"].ToString())
.ToArray());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With