0
有没有办法从DataTable中的单个列中提取所有项目而不是使用For Each循环?从DataTable提取列
例如,下面的建立KeyValuePair从每行一个列表中的一个DataTable
List<KeyValuePair<string, double>> extract = new List<KeyValuePair<string, double>>();
foreach (DataRow item in _dataTableTest.Rows)
{
KeyValuePair<string, double> selection = (KeyValuePair<string, double>)item["Selection"];
extract.Add(selection);
}
一列有没有更好的方式和/或更快的方式做到这一点?