Click here to Skip to main content
15,921,279 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

Can't you declare a three dimensional array? Two dimensions to represent the rows and columns and the third to represent each sheet?
 
Share this answer
 
v2
Try this:
C#
int[][,] arrayOfArrays = new int[100][,];
for (int i = 0; i < 100; i++)
    {
    arrayOfArrays[i] = new int[20, 30];
    }

This declares an array of 100 2D arrays, and assigns each enough room for a 20 by 30 int array.
 
Share this answer
 
You can do that. You can also use lists:
C#
List<List<List<SomeClass>>> myList;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900