Deep Copy Generic List of Classes

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
If I have a generic.list(of ClassA), is there a simple way to create a deep copy of this list that will not affect the original copy? It seems to work if I have a generic list of Structures, but for some reason the copy constructor for lists of classes only copies pointers to the elements (or maybe a pointer to the whole list?). I would move to structures if it were not for the fact that I cant find a way to edit the members in the structs in the list. eg:

list(0).a = 5   Does not work

Is there some way to get around this without declaring an instance of that structure, like this:

dim str as StructA = list(0)
str.a = 5

Id prefer to just use classes as there are differences between structures and classes, so any help is appreciated. Thanks




View the full article
 
Back
Top