C# Multidimensional Arrays & iOS

Hi,
I have the following (simple) piece of code:

        int[] dim = new int[4];
        dim[0] = 3;
        dim[1] = 4;
        dim[2] = 2;
        dim[3] = 7;

        double [,,,] myValues;
        myValues = new double[dim[0], dim[1], dim[2], dim[3]];

It works perfectly in the editor or in a desktop build, but fails when compiled for iOS with the following error:

Is it linked with iOS only? Why are the multidimensional arrays not supported?

What is the alternative?

Thanks!

So googling around, it appears arrays that are more than 3 dimensions in size (yours is 4D) don’t work on iPhones.

I know that AOT compiles up every class so that they exist in the build and aren’t generated JIT. They probably auto-generate arrays up to 3 dimensions only when doing so.

Don’t use a 4D array… honestly, I can’t think of many reasons to ever use a 4D array. Define a new class/struct instead.

I was using 4D because it is convenient to manipulate (multidimensional interpolation of data). I guess I will probably go with 2D matrices instead, with some methods to extract the right value easily.

Thanks a lot for your answer!