Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
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, 2261👍, 0💬
Popular Posts:
How could Java classes direct program messages to the system console, but error messages, say to a f...
What's the difference between J2SDK 1.5 and J2SDK 5.0? There is no difference, Sun Microsystems just...
WHat will be the result of the following code? #define TRUE 0 // some code while (TRUE) { // some co...
How can we implement singleton pattern in .NET? Singleton pattern mainly focuses on having one and o...
What is the difference between mysql_fetch_object() and mysql_fetch_array() functions in PHP? mysql_...