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 should you do is you want to remove an existing component but would like to make some funtionalities?
How can you handle exceptions in asp.net?
Will the asp.net validators run in server side or client side? How do you do client-side validation in .net? How to disable validator control by client side javascript?
Explain what is event bubbling?
What is request and response in asp.net?
What is simple data binding?
Explain the difference between web user control and web custom control?
How many types of cookies are available in asp?
What is the difference between exe and dll?
What is the purpose of App_Code folder in ASP.NET? Why we this?
What is a web api? Which protocol is used in a web api?
Explain how viewstate is being formed?
How do u deploy ur project?
What is css and what is it used for?
What is a web farm?