I need to convert DataRow into Dictionary using LINQ.
The code below will get the DataRow, the next step is I need convert it to dictionary(ColumnName, RowVale)
var WorkWeekData = from data in mWorkWeekData.AsEnumerable ()
where data.Field<string> ("Code") == code
select data;
It's definitely possible, yes:
var dict = row.Table.Columns
.Cast<DataColumn>()
.ToDictionary(c => c.ColumnName, c => row[c]);