Arraylist deep copy

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I would like to ask if the constructor ArrayList(ICollection c) performs the
deep or shallow copy of "c" collection.

If it perfoms just shallow copy, is there any method for doing a deep one?

Thanks,

Lubomir
 
Lubomir,

It performs a shallow copy. It will not perform a full copy of the
items in the collection when bringing them over.

.NET doesn't really have a mechanism to distinguish between a deep and a
shallow copy operation.

Hope this helps.
 
Hi,

Shallow. IIRC none of the collection classes in the framework does a deep
copy, even if the collected type support ICloneable.

You would have to inherit from the collection you want and implement a deep
copy method. For this the collected class should implement ICloneable
 
Back
Top