Categories:
.NET (357)
C (330)
C++ (184)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (2)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How would one do a deep copy in .NET?
How would one do a deep copy in .NET?
✍: Guest
Answer1:
System.Array.CopyTo() - Deep copies an Array
Answer2:
How would one do a deep copy in .NET?
The First Approach.
1.Create a new instance.
2.Copy the properties from source instance to newly created instance.
[Use reflection if you want to write a common method to achive this]
The Second Approach.
1. Serialize the object and deserialize the output.
: Use binary serialization if you want private variables to be copied.
: Use xml Serialization if you dont want private variable to be copied.
2014-02-26, 2441👍, 0💬
Popular Posts:
How is normally a project management plan document organized ? PMP document forms the bible of a pro...
Can a variable be both const and volatile? Yes. The const modifier means that this code cannot chang...
.NET INTERVIEW QUESTIONS - What is COM ? Microsoft’s COM is a technology for component software deve...
What will be printed as the resultof the operation below: int x; int modifyvalue() { return(x+=10); ...
How do I use forms? The basic syntax for a form is: <FORM ACTION="[URL]">...&l t;/FORM>Wh...