System.Array.Rank (MS BUG?)

S

Schneider

The docs say System.Array.Rank will provide the number of dimensions in the
array. But does not seem to work.
I get 2 back for both 2 and 3 levels of dimensions in the array.

I am forced to use Com interop, could that be breaking this?

I am also using VB.NET.

Strange output.

See my code and locals window copy below:

Looks like a MS bug to me


Schneider

'---CODE--------------------------------------------------------------------
-------------------

Public Shared Function ScheduleSink(ByVal InstrId As Integer, ByVal value As
System.Array, ByVal MatureDate As System.DateTime, ByVal IssuedAmmout As
Double) As PosMan.InstrMaster.ClsScheduleSink

Dim u As Integer

Dim v As Integer

Dim tSched As New PosMan.InstrMaster.ClsScheduleSink

Dim rnk As Integer

Try

If InstrId = 61091 Then

Dim a As Integer

a = 1

End If

rnk = value.Rank

Select Case rnk

Case Is = 2



'---------------------------------------------------------------------------
--------

'-------LOCALS Copy for debug
mode--------------------------------------------------

' Notice rnk=2!, with three elements!

'---------------------------------------------------------------------------
--------



rnk 2 Integer

ScheduleSink Nothing PosMan.InstrMaster.ClsScheduleSink

+ tSched {PosMan.InstrMaster.ClsScheduleSink}
PosMan.InstrMaster.ClsScheduleSink

u 0 Integer

v 0 Integer

- value {System.Array} System.Array

(0,0) "12/01/2016" String

(0,1) "100.0000" String

(0,2) "650000.00" String

(1,0) "12/01/2017" String

(1,1) "100.0000" String

(1,2) "675000.00" String

(2,0) "12/01/2018" String

(2,1) "100.0000" String

(2,2) "725000.00" String

(3,0) "12/01/2019" String

(3,1) "100.0000" String

(3,2) "800000.00" String

(4,0) "12/01/2020" String

(4,1) "100.0000" String

(4,2) "850000.00" String

(5,0) "12/01/2021" String

(5,1) "100.0000" String

(5,2) "900000.00" String

(6,0) "12/01/2022" String

(6,1) "100.0000" String

(6,2) "975000.00" String

(7,0) "12/01/2023" String

(7,1) "100.0000" String

(7,2) "1050000.00" String

(8,0) "12/01/2024" String

(8,1) "100.0000" String

(8,2) "1125000.00" String

(9,0) "12/01/2025" String

(9,1) "100.0000" String

(9,2) "1200000.00" String

(10,0) "12/01/2026" String

(10,1) "100.0000" String

(10,2) "1300000.00" String

(11,0) "12/01/2027" String

(11,1) "100.0000" String

(11,2) "1400000.00" String

(12,0) "12/01/2028" String

(12,1) "100.0000" String

(12,2) "1500000.00" String

(13,0) "12/01/2029" String

(13,1) "100.0000" String

(13,2) "336850000" String



'-------LOCALS Copy for debug
mode--------------------------------------------------

' Notice rnk=2!

'---------------------------------------------------------------------------
--------

rnk 2 Integer

ScheduleSink Nothing PosMan.InstrMaster.ClsScheduleSink

+ tSched {PosMan.InstrMaster.ClsScheduleSink}
PosMan.InstrMaster.ClsScheduleSink

u 0 Integer

v 0 Integer

- value {System.Array} System.Array

(0,0) "06/01/2002" String

(0,1) "20000000.0000000" String

(1,0) "06/01/2003" String

(1,1) "20000000.0000000" String

(2,0) "06/01/2004" String

(2,1) "15000000.0000000" String
 
S

Schneider

never mind, GetUpperBound(1) is what I should be using.

Don't know why I misssed that.

Thanks,

Schneider
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top