diff b/w shaloow copy and deep copy - DOTNET
This is a discussion on diff b/w shaloow copy and deep copy - DOTNET ; hello can anybody explain diffrence between shaloow copy and deep copy in c#...
-
diff b/w shaloow copy and deep copy
hello can anybody explain diffrence between shaloow copy and deep copy in c#
-
Re: diff b/w shaloow copy and deep copy
"sujith" <sujith@discussions.microsoft.com> wrote in message
news:8B187B49-60AA-46B0-BDD0-81E2433EB38C@microsoft.com...
> hello can anybody explain diffrence between shaloow copy and deep copy in
> c#
This applies, not just to C#, but to any language that employs "reference
types".
When copying an object, a shallow copy makes copies of the contents of
fields as defined in the class definition. If one or more of the fields is a
reference type (holds the address where the actual data is stored), then it
is the address that is copied. You end up with multiple references to the
same data.
When you write a method to perform a "deep copy", you don't just copy the
addresses stored in reference type fields, you retrieve the actual data and
make a copy of the data at a new location, thus making the new copied object
fully independent of the original object.
--
Peter [MVP Visual Developer]
Jack of all trades, master of none.
-
Re: diff b/w shaloow copy and deep copy
Similar Threads
-
By Application Development in forum Sharepoint
Replies: 2
Last Post: 08-17-2009, 03:44 PM
-
By Application Development in forum c++
Replies: 3
Last Post: 08-20-2007, 07:02 AM
-
By Application Development in forum CSharp
Replies: 2
Last Post: 08-14-2007, 12:36 PM
-
By Application Development in forum Java
Replies: 6
Last Post: 07-21-2007, 06:04 AM
-
By Application Development in forum Smalltalk
Replies: 7
Last Post: 03-02-2006, 08:00 PM