Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有DataTable很多列。我想提取它的整个第三列,并将值放在一个字符串数组中。而且我不想使用 LINQ,因为我使用的是 .net 2.0 Framework,默认情况下它不支持 LINQ。
DataTable
那么没有 LINQ 我怎么能做到这一点呢?
string[] result = new string[datatable.Rows.Count]; int index = 0; foreach(DataRow row in dataTable.Rows) { result[index] = row[2].ToString(); ++index; }