I don't know if my code is 100% correct, this I'm writing completely from head ![:) smile.png](http://public.gamedev5.net//public/style_emoticons/default/smile.png)
Function for populating 2nd and 3rd dimension should go like this:
void PopulateJKDimensions(ref float[,,] 3dArray, int i, float[,] 2dArray)
{
for (int j = 0; j < 2dArray.GetLength(0); j++)
for (int k = 0; k < 2dArray.GetLength(1); k++)
3dArray[i, j, k] = 2dArray[j, k];
}
What's important to say here is that appropriate dimensions have to be of same sizes, otherwise you need to add additional code to take care of it.
ref is to ensure that changes made inside function to 3dArray remain visible outside the function. I'm still not 100% sure if it would be the same without ref keyword.
And then for main code:
// ...
float[,,] 3dArray = new float[amount, width, height];
float[,] 2dArray;
for (int i = 0; i < amount; i++)
{
2dArray = MethodReturning2dFloatArray( );
PopulateJKDimensions(ref 3dArray, i, 2dArray);
}
// ...
EDIT: Or even easier:
// ...
float[,,] 3dArray = new float[amount, width, height];
float[,] 2dArray;
for (int i = 0; i < amount; i++)
{
2dArray = MethodReturning2dFloatArray( );
for (int j = 0; j < width; j++)
for (int k = 0; k < height; k++)
3dArray[i, j, k] = 2dArray[j, k];
}
// ...