c# - Extract one whole column from DataTable without using LINQ? -


i have datatable many columns in it. want extract entire 3rd column in, , put values in string array. , not want use linq i'm using .net 2.0 framework, default not support linq.

so how can without linq ?

string[] result = new string[datatable.rows.count]; int index = 0; foreach(datarow row in datatable.rows) {     result[index] = row[2].tostring();     ++index; } 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -