数组的数组 [英] Array of an array

查看:92
本文介绍了数组的数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要存储多个二维数组.因此,基本上我想做的就是存储一个数组数组.为了给您一些背景信息,我需要构建一个数组并将其写入电子表格.我需要打开9个不同的电子表格,并从每个电子表格中提取信息.根据给我的指示,必须同时打开所有9个电子表格,以使交叉引用链接正确运行.

我想拥有的是主数组的每个元素,都包含一个二维数组.这可能吗,还是我需要声明9个单独的多维数组变量?

谢谢
Glenn

Hi,

I need to store multiple 2 dimensional arrays. So basically what I want to do is store an array of arrays. To give you some background on what I''m doing, I need to build an array and write it to a spreadsheet. I need to open 9 different spreadsheets and extract information from each of them. Based on the instructions given to me, all 9 spreadsheets need to be open at the same time in order for the cross reference links to work correctly.

What I would like to have is each element of the master array, contains a two dimensional array. Is this possible, or do I need to declare 9 separate multidimensional array variables?

Thank you,
Glenn

推荐答案

不能声明三维数组吗?二维表示行和列,第三维表示每张工作表?
Can''t you declare a three dimensional array? Two dimensions to represent the rows and columns and the third to represent each sheet?


尝试以下方法:
Try this:
int[][,] arrayOfArrays = new int[100][,];
for (int i = 0; i < 100; i++)
    {
    arrayOfArrays[i] = new int[20, 30];
    }


这将声明一个由100个2D数组组成的数组,并为20 x 30 int数组分配足够的空间.


This declares an array of 100 2D arrays, and assigns each enough room for a 20 by 30 int array.


您可以这样做.您还可以使用列表:
You can do that. You can also use lists:
List<List<List<SomeClass>>> myList;


这篇关于数组的数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆