What is difference between clone and copyTo method?

Posted by Kumarkrishna184 under C# on 3/23/2018 | Points: 10 | Views : 1200 | Status : [Member] | Replies : 2
What is difference between clone and copyTo method?

Thanks and Regards,
Krishna Kumar



Responses

Posted by: Vedikaledange on: 1/4/2019 [Member] Starter | Points: 25

Up
0
Down
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 identacle object.

DOT NET

Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Siddhipatel on: 1/28/2020 [Member] Starter | Points: 25

Up
0
Down
-->The Clone() method returns a new array object containing all the elements in the original array.

-->The CopyTo() method copies the elements into another existing array.



Software Developer at iFour Technolab Pvt Ltd

Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response