What?s the difference between the System.Array.CopyTo() and
System.Array.Clone()?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where static variables are stored?

477


Why main method is static in c#?

498


What is serialization in unity?

505


What are the different states of a thread?

533


Explain streamreader/streamwriter class?

538






is it possible to access a remote web service Without UDDI?

547


How do you sort a list in c#?

496


What is ienumerable and iqueryable?

508


What is func c#?

503


What is string method in c#?

498


Why do we use Design Pattern in C#?

576


Which is better interface or abstract class in c#?

445


What is dependency injection?

561


What are verbatim strings in c#?

497


Is a valid int value?

482