Back to list
Views:   62.2K
Replies:  4
Archived

Difference between String.Clone() and String.Copy() method

Could anyone tell me what the difference is between String.Clone() and String.Copy()?

Thanks in advance.
Muzafar Hussain, Dec 06, 2010
Reply 1
Clone will copy the structure of a data where as Copy will copy the complete structure as well as data.

string[] arr2 = arr1; //copy
string[] arr4 = (string[])arr3.Clone();
http://net-informations.com/faq/framework/clone-copy.htm

prings
Pringston Maliak, May 09, 2013
Reply 2
Excatly!

String.Clone() give pointer value(ie Current memory Reference)

String.Clone() Create an instance in Heap Memory and give pointer value(ie New Memory Reference)
Mohammed Sarfaraz, Jan 23, 2011
Reply 3
String.Copy() 
Creates a new instance of String with the same value as a specified String. 


String.Clone()
Returns a reference to this instance of String. 


ChersBy
Prawin
Prawin Kumar, Jan 18, 2011
Reply 4
clone()-----returns the reference of an object in the memory

copy()------copy the structure and data of the object.
Muzafar Hussain, Dec 07, 2010


Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas