unboxing a string array object

  • Thread starter Thread starter psmith
  • Start date Start date
P

psmith

I am getting data back from a COM object.

In the debugger, I get back an object as follows:

result -> system.array
[0,0]-> {length=102} string[,]
|
|--> [0,0] ="company 1" string
|--> [1,0] = "company 2" string
etc.

but i am having problems unboxing the information.

if I do int
length = (int)(string[,])((Array)result).Getlength(0)
I get length =1 not 102!!
and also I cannot get to string [0,0],[1,0] etc..

any help appreciated
 
psmith,

When you call GetLength and pass in 0, you are getting the length of the
first dimension, which apparently is one. What you want to do is get the
length of everything. In that case, use the Length property on the Array
class.

Hope this helps.
 
Back
Top