Arraylist中的多维数组如何输出 ArrayList testArrayList = new ArrayList();int[,] testArray = { { 1, 23, 4, 5 }, { 23, 2, 56, 2 }, { 2, 22, 6, 8 } };testArrayList.Add(testArray);怎样正确输出这个多维数组呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 晕我是得不到多维数组的值testArrayList[0] 是object怎样转成多维数组 ArrayList testArrayList = new ArrayList(); int[,] testArray = { { 1, 23, 4, 5 }, { 23, 2, 56, 2 }, { 2, 22, 6, 8 } }; testArrayList.Add(testArray); int[,] test = (int[,])testArrayList[0]; Response.Write("<BR>"); foreach (int i in test) { Response.Write(i); Response.Write("<BR>"); } } 或者用List<int[,]>代替ArrayList ArrayList testArrayList = new ArrayList(); int[,] testArray = { { 1, 23, 4, 5 }, { 23, 2, 56, 2 }, { 2, 22, 6, 8 } }; testArrayList.Add(testArray); int[,] test = (int[,])testArrayList[0]; foreach (int i in test) { Console.WriteLine(i); }方法不错,建议用list<> 如何获取用户当前正在连接互联网的网卡的MAC地址? windows media player 二次开发,播放AVI有声无图像? 线程问题 如何解决:现运行的工作流和已经持久化的工作流间的“版本差异” 小弟请教一个C#调用DLL的问题? 为解决日文操作系统乱码问题,发段代码,请大家勿进 無法將'div'項目巢狀化至'tbody'項目中,請問有何方法可以實現? 大家帮忙,这样的合作怎么分成才好! 再一次的打包问题,急 怎么用C#去加载Excel表格 在线等,字符串替换问题,立刻给分 DocumentCompleted事件的怪问题,为什么在有的机不会触发呢?
我是得不到多维数组的值
testArrayList[0] 是object
怎样转成多维数组
int[,] testArray = { { 1, 23, 4, 5 }, { 23, 2, 56, 2 }, { 2, 22, 6, 8 } };
testArrayList.Add(testArray); int[,] test = (int[,])testArrayList[0];
Response.Write("<BR>");
foreach (int i in test)
{
Response.Write(i);
Response.Write("<BR>");
}
}
int[,] testArray = { { 1, 23, 4, 5 }, { 23, 2, 56, 2 }, { 2, 22, 6, 8 } };
testArrayList.Add(testArray); int[,] test = (int[,])testArrayList[0];
foreach (int i in test)
{
Console.WriteLine(i);
}方法不错,
建议用list<>