What?s the difference between the System.Array.CopyTo() and
System.Array.Clone()?
Answers were Sorted based on User's Feedback
Answer / rajesh
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 (which neither of these
methods performs) would create a new instance of each
element's object, resulting in a different, yet identacle
object.
Is This Answer Correct ? | 7 Yes | 1 No |
Answer / guest
The first one performs a deep copy of the array, the second
one is shallow
Is This Answer Correct ? | 0 Yes | 3 No |
Answer / ranjanatyagi
the first one copy both the data and the structure i.e.
schema of the arry and the second one copy only the
structuere not data.
Is This Answer Correct ? | 1 Yes | 4 No |
Which sorting algorithm is best?
Are constructors inherited c#?
How does array sort work?
What is the c# equivalent of c++ catch (…), which was a catch-all statement for any possible exception? Does c# support try-catch-finally blocks?
Why do we use partial class in c#?
What is the use of list in c#?
What is difference between struct and class in c#?
What is dataset and dataadapter in c#?
Difference between type constructor and instance constructor? What is static constructor, when it will be fired? And what is its use?
What is a factory in c#?
To create a localized application which namespaces are necessary?
When To use HashTable In C#