If you want to store values of a datatable in a jagged array using LINQ you can achieve in the following ways.
string[][] Value = dt.Rows.OfType<DataRow>().
Select(r => dt.Columns.OfType<DataColumn>().
Select( c => r[c.ColumnName].ToString()).ToArray()).
ToArray();
string[][] Value = dt.Rows.OfType<DataRow>().
Select(r => dt.Columns.OfType<DataColumn>().
Select( c => r[c.ColumnName].ToString()).ToArray()).
ToArray();
Comments
Post a Comment