Articles → .NET → 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 05, 2010

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250