Reputation: 1338
I'm trying to get the count of items in one of the dimensions of a 2 dim array.
For example, a simplistic version of my array looks like this:
my_array(0)(1) = "a"
my_array(0)(2) = "b"
my_array(0)(3) = "c"
I'm trying to find out the count of items in my_array(0). But of course you can't do "my_array(0).count", so trying "my_array.count" simply gives me 1. So how do I get the count of the items in the second dimension?
Thanks.
Upvotes: 0
Views: 1176
Reputation: 6948
If your looking for the count of every element in your array you might want to consider using the Sum function:
Dim totalcount As Integer = m_array.Sum(Function(x) x.Count)
Upvotes: 0
Reputation: 460108
You can use GetLength
:
Dim dimLength = my_Array.GetLength(1)
Upvotes: 1