By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,824 Members | 1,627 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,824 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]


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]

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:

If the link above wrapped, try
// Bjorn A
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.