[Gambas-user] Collections

Fabien Bodard gambas.fr at ...626...
Sat Jan 16 23:58:44 CET 2010


just don't forget when you add multiple array, think to add new array
as only the memory address is added to the collection , not the array
content. In other case all the array in the collection link to  the
same one

dim mycol as NEW collection
dim i as integer
dim aText as string[]

For i = 0 to 15
aText = NEW string[4]
aText.Add(aText,i)

next


2010/1/16 Pino Zollo <pinozollo at ...626...>:
> Il sabato 16 gennaio 2010 15:53:11 gambas-user-request at ...720...net
> ha scritto:
>> The Gambas debugger is fantastic.
>
> Here is attached the evidence that all keys point to the same array.
>
> I have improved  previously attached project adding
>  Lista.Clear
> after
>  CASE 6
>
> and removing  INC i from the external
> DO WHILE 0 < MyArray.Count   ' also changed i to 0
>
> LOOP    ' thanks Werner
>
> So it is the filling of Lista that fails....possibly a bug; besides
> both
>  Lista.Add(Parti, myStruc.Value(1))
>
> and
>
>  Lista[myStruc.Value(1)] = Parti
>
> Produce the same result.
>
> As I said in a previous append the work-around of joining the two parts of
> Parti into a single string such as:  Jo = Parti[0] & "~" & Parti[1]
> and than recovering with Split(Element, "~")
> works perfectly....
>
> ...so the problem is just when a String[] is stored into the Collection
>
> What do you think Benoît ?
>
> Thanks for the attention
>
> Pino
> --
> Key ID: 0xF6768208
> Key fingerprint = B16D 0A7C 5B29 A334 CE6A  71F6 EAF8 3D88 F676 8208
> Key server: hkp://wwwkeys.eu.pgp.net
>
> ------------------------------------------------------------------------------
> Throughout its 18-year history, RSA Conference consistently attracts the
> world's best and brightest in the field, creating opportunities for Conference
> attendees to learn about information security's most important issues through
> interactions with peers, luminaries and emerging and established companies.
> http://p.sf.net/sfu/rsaconf-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>




More information about the User mailing list