2 dimensional arrays collection - how to?

  • Thread starter Thread starter Macin
  • Start date Start date
M

Macin

Hi,

I need to create a collection of 2 dimensional arrays. How can I do this?
What type of collection?

And the second question would be, how can I then display all of the small
arrays at once as showed below?

One, two dimensional array:
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx


I want to dispaly them like this, after they all are in a collection.

xxxxxxxxx xxxxxxxxx xxxxxxxxx
xxxxxxxxx xxxxxxxxx xxxxxxxxx
xxxxxxxxx xxxxxxxxx xxxxxxxxx
xxxxxxxxx xxxxxxxxx xxxxxxxxx

xxxxxxxxx xxxxxxxxx xxxxxxxxx
xxxxxxxxx xxxxxxxxx xxxxxxxxx
xxxxxxxxx xxxxxxxxx xxxxxxxxx
xxxxxxxxx xxxxxxxxx xxxxxxxxx

and so on...

Has anyone got any idea???
Thanks
 
ArrayList listOf2DArrays = new ArrayList();
object[,] my2DArray = GetItFromSomewhere();
listOf2DArrays.Add(my2DArray);

if you would like to encapsulate some functionality into the arrays,
consider writing a wrapper class for it
just like
class Wrapper
{
private ArrayList arrays;
private object[,] arr;

....
public override string ToString()
{
StringBuilder sb = new StringBuilder();
//iterate the ArrayList and build the string output on the stringbuilder
like
xxx xxx
xxx xxx
xxx xxx
}
}
 
Back
Top