I have a DataTable with multiple columns. I want to get a List<String> of all column of DataTable. How can I do that? List<string> fields; foreach (DataRow dr in dt.Rows) { fields.Add(row[0].ToString()); } how can i do this??
List<string> NameList = (from r in dt.AsEnumerable() select r.Field<Column1DataType>("Column1") + r.Field<Column2DataType>("Column2")).ToList();
List<string> fields = new List<string>(); for (int column = 0; column < dt.Columns.Count; column++) { for (int row = 0; row < dt.Rows.Count; row++) { fields.Add(dt.Rows[row][column].ToString()); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)