Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How would one do a deep copy in .NET?

Answer Posted / mario j vargas

You can perform a deep copy in C# by implementing the
ICloneable interface and manually assigning the values of
each member field in the current instance to the new
instance being returned. It is important to mention in the
implementation's documentation whether or not the copy is a
shallow or deep copy.

Bhagyesh suggested using a copy constructor. This is
something I had never seen in C#, only in C++, but the idea
sounded very compelling and I think this could be another
way to achieve a deep copy. You should check out the article
"How to: Write a Copy Constructor (C# Programming Guide)" in
the MSDN documentation.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between web user control and web custom control?

999


Which validator control you use if you need to make sure the values in two different controls matched?

1075


What is meant by web application?

955


What is the page life cycle in asp.net?

973


Explain the difference between Web Garden and Web Farm?

1007


What is preprocessor in .net?

979


How is the asp.net mvc architecture different from others? : asp.net mvc

1022


Explain what the contents of cookie?

1062


What is difference between view and partial view?

929


How tooltip is set through code-behind in ASP.NET?

1093


Give a few examples of page life cycle events.

1130


When you are running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?

1063


Explain the code Access Security (CAS) in .net Framework?

1241


What are the different methods of session maintenance in asp.net?

1022


How u refer webservices?

1956