I want to know how to transform a DataTable into a Dictionary. I did something like this.
using System.Linq; internal Dictionary GetDict(Da
i think this will help you:
DataTable dt = new DataTable(); dt.Columns.Add("Column1"); dt.Columns.Add("Column2"); dt.Rows.Add(1, "first"); dt.Rows.Add(2, "second"); var dictionary = dt.Rows.OfType().ToDictionary(d => d.Field(0), v => v.Field(1));