Converting

  • Thread starter Thread starter Yama
  • Start date Start date
Y

Yama

Hi,

I would like to convert (box and unbox) a string[,] to ArrayList type.

I tried the following:
string[,] arrayHeaderInfo = new string[stringHeader.Length, 2];

stringHeaderSplitted = stringHeader.Split(",");

arrayHeaderInfo[i,0] = stringHeaderSplitted[0];

arrayHeaderInfo[i,1] = stringHeaderSplitted[1];

arrayListBoxing = (ArrayList)arrayHeaderInfo;

After compiling you will get this error: Cannot convert type 'string[*,*]'
to 'System.Collections.ArrayList'


Any sugestions?

Thanks,

Yama
 
for a start, one problem you are facing is trying to convert a 2 dimensional
array into a one dimensional array.

ideally, you need another object to store each set of data. Then you could
add each object to the arraylist.

If it was a one dimensional list, then it would be easy.
 
Back
Top