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 can't 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
I'd prefer to just use classes as there are differences between structures and classes, so any help is appreciated. Thanks

Deep Copy Generic List of Classes
Gerry2007
How are you copying the list Either way, you will have to implement some kind of clone mechanism in your class which creates a new object from an existing object. Likewise, you could then implement a clone method in an inherited class of the list to clone the list.
One thing to bear in mind is that depending on the number of objects in your list, cloning can take a bit of - relative - time (i.e. is something you don't do trivially). And, of course, you will double the amount of memory usage (although, that's pretty much irellevant these days - depending on thesize of the list...).