Monday, March 10, 2014

Clone objects C#

Cloning is a matter between copy object and copy its references. There are two types of cloning, deep clone and shallow clone. If you copy only references it’ll call shallow copy. If you copy referenced objects it’ll call deep copy.
Shallow copy:

Deep copy:
There are two ways of doing this.
1. Use the copy constructor (a good practice)
2. Using ICloneable interface
Manual way Using memberwiseclone

No comments :

Post a Comment