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

In which order the constructor is called for an inherited class?

534


what is the difference between the debug class and trace class?

516


What are the different types of assemblies available and their purpose?

502


Is concurrent queue thread safe?

476


What is the difference between User controls and Custom Controls?

548






What is array and its types in c#?

522


What is call back method?

516


Why extension method is static?

467


Where do we use static class in c#?

487


What is the use of parse in c#?

450


User's session is explicitly killed by which method ?

504


Why var is used in c#?

491


Can you call from an inherited constructor to a specific base constructor if both base class and an inheriting class has a number of overloaded constructors?

520


Can struct be static in c#?

508


Can int be null c#?

523