If I am reading the articles correctly then if an object implements the
Icloneable interfact and it is cloned, then for all the value types the value
is copied to the new object and for all the reference types, only the
reference(pointers) are copied. So what is gained? If I have an arraylist
of value type objects then the .Clone Method will copy the values to a new
arraylist but if the arraylist objects are reference types then only the
reference is copied to the new arraylist. Then when I change a value type in
the new arraylist, the original arraylist is not changed but If I change a
reference type in the new arrraylist, then the original arraylist will also
reflect that change since they both point to the same instance of the object.
Is all this correct?
"Herfried K. Wagner [MVP]" wrote:
"J L" <jo**@marymonte.com> schrieb: What does "shallow" and "deep" copy mean?
An insight into cloning objects in .NET
<URL:http://www.codeproject.com/dotnet/Clone.asp>
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>