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

Answer Posted / sree..

The below code does a deep copy.
Let me know if something is wrong with the code.

string[] array = new string[1] { "aaa" };
string[] copy = new string[1];
array.CopyTo(copy, 0);

copy[0] = "xyz";
Console.WriteLine(array[0]);

I see array[0] value as "aaa".

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

explain the features of static/shared classes.

501


How do I link two windows forms in c#?

473


Does google use c#?

517


How many destructors can a class have?

593


What is callback method in c#?

488






Define thread?

581


What is expression tree in c#?

483


Explain dataset.acceptchanges method in .net?

545


What is difference between constants and readonly in c#?

488


Which config file has all the supported channels/protocol?

552


What is the difference between ref and out parameters in c#?

460


What is difference between for and foreach in c#?

471


What are the steps to make an assembly to public?

500


What are the fundamental differences between value types and reference types?

551


What are primitive types in c#?

535