[Gambas-user] some questions around collections copy and collections inside collections
Tobias Boege
taboege at ...626...
Tue Sep 6 22:27:14 CEST 2016
On Tue, 06 Sep 2016, Tobias Boege wrote:
> Of course, if you know that your Collection only contains Collections, which,
> in turn, you are sure only contain primitive data types (which can easily be
> deep-copied), then you can, of course, write a deep copy function:
>
> '' Assumes ~cCol~ is a Collection of Collections, each of which contains
> '' data of primitive types.
> Private Function CopyMyCollection(cCol As Collection)
Private Function CopyMyCollection(cCol As Collection) *As Collection*
> Private cNew As New Collection
*Dim* cNew As New Collection
> Dim cElt As Collection
>
> For Each cElt In cCol
> cNew[cCol.Key] = cElt.Copy()
> Next
> Return cNew
> End
>
The above are some obvious errors which I just noticed and might as well
correct. I still haven't compiled the code to see if it actually works.
It is just to give you the idea.
Regards,
Tobi
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the User
mailing list