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

What is the purpose of a constructor in c#?

653


What is encapsulation in csharp?

704


Why constructor is used in c#?

657


What is method and function in c#?

705


What is the difference between interface and abstract class in c#?

668


How assembly versioning in .NET prevent DLL Hell problem?

698


Where do we use static class in c#?

657


What do u mean by thread safe?

694


What is reflection c#?

635


Where do I put dll files?

746


What is the keyword used to prevent a class from being inherited by another class?

895


What is the components of window?

680


Why dictionary is used in c#?

702


What is multithreading with .net?

755


Can a struct inherit from an interface in c#?

724