Friday, March 4, 2011

difference between clone and copy in .net

DataTable dt=new DataTable();
dt=ds.Tables[0].copy(); will copy all the data and structure to dt table

dt=ds.Table[0].clone(); will create only the structure of table not data.





Clone -- Creates another reference (Pointer) to the same location.

Copy -- Creates two different references to two different Address Spaces.

No comments :

Post a Comment