C#,DataTable到ArrayList?

Dat*_*ase 8 c# datatable arraylist

我有一个几行的数据表,每行有几列.
我想创建一个arraylist,将所有行都计算为一个字符串,
这样每个数组项都是这样{1;qwqww;qweqweqwe;qweqweqw;qwe}
的.字符串中的项将被分开,; 它是一个.NET 2解决方案

谢谢

Tim*_*mwi 10

这是一个实际有效的解决方案.

ArrayList rows = new ArrayList();

foreach (DataRow dataRow in myDataTable.Rows)
    rows.Add(string.Join(";", dataRow.ItemArray.Select(item => item.ToString())));
Run Code Online (Sandbox Code Playgroud)

但是,我觉得我应该指出使用过时是不明智的ArrayList.请List<string>改用,因为行是字符串:

List<string> rows = new List<string>();
Run Code Online (Sandbox Code Playgroud)

其余的代码是一样的.