Check if an array is multidimensional

  • Thread starter Thread starter Guest
  • Start date Start date
very dirty but could get you going atm

Try
Dim inta(2, 3, 6) As Integer
Dim int As Integer = 0
Try
Dim test As Integer
Do While True
test = inta.GetUpperBound(int)
int += 1
Loop

Catch ex As IndexOutOfRangeException
'int will now give you the dimensions
inta(1, 1, 1) = int
End Try
Catch ex As Exception

End Try

hope it helps

eric
 
I'm implementing the ICollection interface into a class of mine

In the msdn help
ms-help://MS.VSCC.2003/MS.MSDNQTR.2004APR.1033/cpref/html/frlrfSystemCollectionsICollectionClassCopyToTopic.ht
it states several exceptions that can be thrown.

one of them is that the the parameter array cannot be multidimensiona

When I look at the code from EricJ I cannot help think there has to be better way to check if the array is multidimensional or not... I'm not a vb.net expert bt
 
there should be but i don't know it and until you do this could keep you
going :)

eric

Philip Wagenaar said:
I'm implementing the ICollection interface into a class of mine.

In the msdn help:
ms-help://MS.VSCC.2003/MS.MSDNQTR.2004APR.1033/cpref/html/frlrfSystemCollect
ionsICollectionClassCopyToTopic.htm
it states several exceptions that can be thrown..

one of them is that the the parameter array cannot be multidimensional

When I look at the code from EricJ I cannot help think there has to be
better way to check if the array is multidimensional or not... I'm not a
vb.net expert btw
 
Back
Top