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

------------------------------------------------------------------------------
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to