How to declare an 3-dimensional array in C#?

I just tried to create an 3-dimensional array in C# (which seems to work, at least there are no errors)

private int[,,] myarray = new int [sizeX,sizeY,sizeZ];

but when I try to write to the array

myarray [valueX,valueY,valueZ] = 1;

I get the following error:

error CS0266: Cannot implicitly convert type float’ to int'. An explicit conversion exists (are you missing a cast?)

How do I use multidimensional arrays correctly?

Thanks in advance

Greets, xLuboex

Sounds like the values you are putting in the array are floats, so you would need to do this:

flloat[,,] myarray = new float[sizeX, sizeY, sizeZ];

Define a 1 dimensional array of floats

float[  ] floatArray = new float[  ]; 

Define a 2 dimensional array of integers that is 3x3

int[,] intArray2D = new int[3,3];

Define a 3 dimensional array of strings that is 3x3x3

string[ , , ] stringArray3D = new string[3,3,3];

Add to the float array, the float i = 0.3f at position 5

float i = 0.3f;
floatArray[4] = i;

Add to the integer array the integer j = 6 at position 2 on the X and 3 on the Y

int j = 6;
intArray2D[1, 2] = j;

Add a new string to the string array at position 2 on the X, 1 on the Y, and 3 on the Z

string s = "another string";
stringArray3D[1, 0, 2] = "this new string";

Add another string to the string array at 3,1,1

stringArray3D[2, 0, 0] = s;

Remember arrays use an index, so start counting at 0