The Array.Rank on C# -
i'm studying array. wondering array.rank, here example:
using system; public class example { public static void main() { int[] array1 = new int[10]; int[,] array2= new int[10,3]; int[][] array3 = new int[10][]; console.writeline("{0}: {1} dimension(s)", array1.tostring(), array1.rank); console.writeline("{0}: {1} dimension(s)", array2.tostring(), array2.rank); console.writeline("{0}: {1} dimension(s)", array3.tostring(), array3.rank); } } // example displays following output: // system.int32[]: 1 dimension // system.int32[,]: 2 dimension // system.int32[][]: 1 dimension
my question is: why array3.rank
return 1 dimension not 2?
system.int32[][]
is 1 dimension, array of array, not 2d array : system.int32[,]
Comments
Post a Comment