How do I get the inner arrays length in a 2d array in C#?
Posted
by Phukab
on Stack Overflow
See other posts from Stack Overflow
or by Phukab
Published on 2010-03-16T19:39:25Z
Indexed on
2010/03/16
19:41 UTC
Read the original article
Hit count: 171
Lets say I create a jagged 2d array like so:
public static char[,] phoneLetterMapping = { {'0'}, {'1'}, {'A', 'B', 'C'} };
Now, given the first index of the array, I would like to be able to get the length of the inner array.
So, I would like to be able to do something like:
phoneLetterMapping[2].length
I can do that in Java. But the intellisense menu doesn't return the normal members of an array when I type in the first bracket of the [][] 2d array.
So, how do I get the inner array lengths in my 2d array in C#?
© Stack Overflow or respective owner