using Linq you can easily get list/array of all column names of a datatable:
string[] columnNames = dt.Columns.Cast< datacolumn > ().Select(x => x.ColumnName).ToArray(); //or in LINQ string[] columnNames = (from dc in dt.Columns.Cast< datacolumn >() select dc.ColumnName).ToArray();
No comments:
Post a Comment