423,850 Members | 1,661 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,850 IT Pros & Developers. It's quick & easy.

How many rows in my array object

P: n/a
How do you find out the number of rows in the array {Array}

I have [0,0]
[0,1]

[1,0]
[1,1]
.....

thanks
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Krish" wrote...
How do you find out the number of rows in the array {Array}

I have [0,0]
[0,1]


The concepts of "rows" and "columns" suggests only two-dimensional arrays,
but there can actually be many more.

To get the number of dimensions you can use

int dimensions = myArray.Rank;

To check how "big" each dimension is you have e.g. the method GetUpperBound
which takes the "dimension" as argument.

But let's say that you only have just two dimensions, and want to know how
many "rows" there are, you check the "first dimension":

int rows = myArray.GetUpperBound(0) + 1;

For other things you can do with an array:

http://msdn.microsoft.com/library/de...ClassTopic.asp

If the link above wrapped, try http://tinyurl.com/ywhb8
// Bjorn A
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.