Whats a "shallow copy" of an objects

Possible Duplicate:
What is the difference between a deep copy and a shallow copy?

I saw this today here: http://msdn.microsoft.com/en-us/library/system.web.routing.route.aspx and one of the member functions was:
"MemberwiseClone - Creates a shallow copy of the current Object. (Inherited from Object.)"
So whats a "shallow copy" verse a ... "Deep copy"?


Shallow copy only replaces the properties on the current level of the object, that means if you have an object as a property it will have the same reference as your original. This is not a problem if your properties are value types or primitives of course.

链接地址: http://www.djcxy.com/p/40746.html

上一篇: 如何克隆c#中的祖先?

下一篇: 什么是对象的“浅拷贝”