Wednesday 4 June 2014

difference between copy and clone in c#


Clone- makes a copy of an object at the root level means only copy its structure but not its data (if we talk about datatable)

Copy- a copy of an object and all its child objects means copy its structure and data both.

in other terms

Clone method can not create datarow but Copy method create both structure and datarow.

dtFinalSeriesAfterCalc = dtSeriesforCalc.Clone();

dtResult = dtChart.Copy();

No comments:

Post a Comment