关于arraylist类中add数组后的遍历问题 ArrayList ReportList = new ArrayList(); ReportList.Add(fileLine); fileLine是个数组 foreach (object list in ReportList)后list显示的类型是object{string[]}
如何遍历list里面的数组内容啊?
------解决方案-------------------- foreach (string list in (string[])ReportList[0]) { ... }
------解决方案--------------------
C# code
int[] fileLine = new int[] { 1, 2, 3, 5 };
ArrayList ReportList = new ArrayList();
ReportList.Add(fileLine);
foreach (int[] list in ReportList)
{
for (int sl = 0; sl < list.Length; sl++)
{
Console.Write(list[sl] + " ");
}
}
------解决方案--------------------