punjabtechnicaluniversity.blogspot.in
OR What is shallow copy and deep copy ?
OR What is shallow copy and deep copy ?
Cloning is achieved by using ICloneable of the System namespace. It has a “Clone” method which actually returns the reference of the same copy. Clone method allows a Shallow copy and not a deep copy. In Shallow copy if you make changes to the cloned object it actually does change on the main object itself. So how is deep copy achieved, by using “ISerializable” interface? So what you do is first serialize the object then deserialize back to a complete new copy. Now any changes to this new copy do not reflect on the original copy of the object, this is called as Deep copy.
0 comments:
Post a Comment
North India Campus