Archive

Posts Tagged ‘Datatable to list’

Convert DataTable To List

November 30, 2012 Leave a comment

static List<string[]> ConvertTable(DataTable table)
        {
            return table.Rows.Cast<DataRow>()
                .Select(row => table.Columns.Cast<DataColumn>()
                    .Select(col => Convert.ToString(row[col])).ToArray()).ToList();
        }
Advertisements
%d bloggers like this: