casting + arrays

BlitzMax Forums/BlitzMax Programming/casting + arrays

SB(Posted 2005) [#1]
i have something like this:

local list:Tlist
local array1:Object[]
local array2:customtype[]

For local n = 0 to 10
local myobject:customtype[] = new customtype
list.AddLast(myobject)
next

array1 = list.ToArray()

rem
now i have a list and an array each containing the references to 10 objects of my custom type.
with the list having no specifieed type (:object) i
will have to use casting to access the object's fields
in the array. if the type customtype has a field x then
i could do it that way:
end rem

print customtype(array1[1]).x

rem
to make it easier i wantet to use an other array with the
correct type and hand over the values by the use of casting like this:
end rem

array2 = customtype(array1)

rem
but that does not work, even though it is possible to "copy" the values of of one specific field of the Array like
this:
end rem

array2[1] = customtype(array1[1])

why is it possible to use casting on every element of the array but impossible to change the type ove the entire array??? did i do something wrong???

Thanks!