How to calculate the size of hole array
How to get the size of hole array including all elements means total size of array.....?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Smart LuckyPosted Feb 11, 2011, 3:24 AM
Soft CornerPosted Feb 10, 2011, 7:12 AM
Using array Length property ,
If it's a one-dimensional array
a,will give then number of elements of
a.If
bis a rectangular multi-dimensional array (for example,int[,] b = new int[3, 5];)will give the number of dimensions (2), and
will get the length of any given dimension (0-based indexing for the dimensions - so
b.GetLength[0]is 3 andb.GetLength[1]is 5).See System.Array Members for more info.
, there is a concept of a "jagged array", which is really nothing more than a single-dimensional array of (typically single-dimensional) arrays. For example, one could have
Note that the 3 members of
call have different lengths. In this case, as beforec.Lengthwill indicate the number of elements ofc, (3) andc[0].Length,c[1].Length, andc[2].Lengthwill be 3, 2, and 7, respectively.Amit ChoudharyPosted Feb 10, 2011, 7:11 AM
Use the function GetUpperBoaund(
Thanks...