Creating an Array of Multidimensional Arrays

The title says it all. I have the following code:

public int amount;
public int x;
public int y;

public int[][,] derp;

public void resizeArray(){
    int[][,] newArray = new int[amount][y, x];
    derp = newArray;
}

Then I receive the following error: Invalid rank specifier: expected ‘,’ or ‘]’

Maybe this can’t even be done but I would like to have an array and have every object inside that array have it’s own multidimensional array. So array[0] has it’s own multidimensional data and array[1] has it’s own multidimensional data and array[2] has it’s own multidimensional data and so on…

Is this even possible? Why do I receive this error? How can I fix it?

Thanks!

I think you could do it like this:

int[,,] newArray = new int[amount, y, x];

If you want an array of 2-dimensional arrays, rather than a 3-dimensional array, then do

public void resizeArray(){
    derp = new int[amount][,];
}

(There’s no point to the newArray variable; you can just assign the derp variable directly.) Then for each entry, you need to create the multi-dimensional array:

derp[0] = new int[5, 10];
derp[1] = new int[10, 20];
// etc.

The reason you’d do it this way is if each multi-dimensional array should be a unique size. If they are all the same size, then you might as well use a 3-dimensional array.