Click here to Skip to main content
15,846,727 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i have a doubt regarding copyTo() and clone().I read some theory theory that copy is used for deep copy and clone is for shallow copy but both r copied data and structure.please somebody help me regarding this .
Posted

1 solution

The Clone method returns a new array (a shallow copy) object containing all the elements in the original array. The CopyTo method copies the elements into another existing array. Both perform a shallow copy. A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array. A deep copy would create a new instance of each element's object, resulting in a different, yet identical objects.

Refer this[^]


--Amit.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900