C# Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 1969 Page Views: 

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



Posted By: Avi Date: 15 October 2009 04:33:18 AM
 Answer:

CopyTo() method copies all the elements of the current one-dimensional Array to the specified one-dimensional Array.

Clone() method makes a clone of the original array. It returns an exact length array.

Both methods performs a shallow copy.

A shallow copy of an Array copies only the elements of the Array, whether they are reference types or value types, but it does not copy the objects that the references refer to. The references in the new Array point to the same objects that the references in the original Array point to.

While a deep copy of an Array copies the elements and everything directly or indirectly referenced by the elements.


Posted By: eTechPlanet


Date: 15 October 2009 04:33:18 AM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image sKyxZk
Related Questions
C# : What is meant by MulticastDeligate?

What is meant by MulticastDeligate?

MulticastDeligate is a special class.It is a deligate that can have more than one element in its inv....
Category: C# Date: 10/1/2010 11:54:31 AM
C# : Write a code to convert string to integer (int) data type.

Write a code to convert string to integer (int) data type.

class conver { public static void Main() { String a = "2000"; int x = Convert.ToInt32(a)....
Category: C# Date: 10/1/2010 11:53:31 AM
C# : Is it possible to override a private virtual method?

Is it possible to override a private virtual method?

The naswer is no. Also Virtual or abstract methods can not have private as access modifier. Also pri....
Category: C# Date: 10/1/2010 11:52:31 AM
C# : Specify the ways which help in breking out the block or loop when working with the nested loops?

Specify the ways which help in breking out the block or loop when working with the nested loops?

There are several ways to break out of a nested loop:- 1. The simplest and the easiest way is to us....
Category: C# Date: 10/1/2010 11:51:31 AM
C# : What is the use of the dispose method in C#?

What is the use of the dispose method in C#?

Dispose() method is called programatically by the user and it is used to de-allocate the unused obje....
Category: C# Date: 10/1/2010 11:50:31 AM