| Start |
|---|
| Implementing ICloneable in a class Implement Later to be used as follows: Notice that changing the age of |
| Implementing ICloneable in a struct The implementation of ICloneable for a struct is not generally needed because structs do a memberwise copy with the assignment operator Another reason would be if the struct contains a reference type (or an array) which would need copying also. Later to be used as follows: Syntax
RemarksThe It is up to the author to decide if cloning means only shallow copy, or deep copy. For immutable structures containing references it is recommended to do a deep copy. For classes being references themselves it is probably fine to implement a shallow copy. NOTE: In |
Read Article
https://develop.horje.com/learn/1434/reference