Articles → CSHARP → Deep Copy And Shallow Copy

Deep Copy And Shallow Copy






Shallow Copy




ArrayList a = new ArrayList();
ArrayList b = new ArrayList();




a.Add("2");




b = (ArrayList)a.Clone(); // shallow copy








a.Add("3");









Deep Copy






b = a;








a.Add("3");









Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, May 5, 2010

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250