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
What is the difference between CC and BCC?
Explain different authentication modes in asp.net?
What does asp stand for in asp.net?
What are the different validators in asp.net?
Which is better asp.net or php?
What is application variable in asp.net?
Define web.config in .net?
How can we create custom controls in asp net?
What is a master page and what does it do?
How can you implement encapsulation in asp.net?
What is bson in web api?
What is owin authentication?
What is session in http request?
Difference between singleton and singlecall.
How do you deploy your asp.net application?