How to clone (deep copy) dictionary

Hi,

I think your understanding seems mostly correct.

Basically, it depends variable type: Value types or Reference types.
It’s unnecessary special care to copy Value types such as Int32, Double etc.
However, Reference Types such as List, array etc are needed special care (Copy method etc. if they have) to copy deeply. (Without it, it will be shallow copy)
Note: String type (and object type) is special type and it behaves like value type when copy even though it’s reference type.

Regards,

2 Likes