+ 1
Multi Dimension Array Length
int[,] arr = new int [4,4]; how to get length of each dmnsion array in c#? in java i can use: for(int i=0;i<arr.Length;i++){ for (int j=0;i<arr[0].Length;i++){ //do smthing } } but in c# i cant use arr[0].Length. help guys thx.
3 Respuestas
+ 7
It is because you used a multi dimensional array and not an array of arrays, so array[0] is forbidden
array.Length work, but to access values of array, you have to do array[i,j]
To get the length of the second dimension, you have to use
arr.GetLength(1)
+ 3
You're welcomed :)
+ 2
thx man y'r awesome !