How would one do a deep copy in .NET?
By admin on Jan 8, 2007 in ASP.NET Interview Questions, Technical
System.Array.CopyTo() - Deep copies an Array
Java Interview Questions | IT interview questions | Software Testing Interview questions | .Net Interview Questions | Job Interview Questions & Answers | Tough Interview Questions | Technology Interview Questions | Tech Interview Questions | Testing Interview Questions | SAP Interview Questions | ABAP Interview Questions | Data Warehousing Interview Questions
Current ArticleBy admin on Jan 8, 2007 in ASP.NET Interview Questions, Technical
System.Array.CopyTo() - Deep copies an Array
2 Comment(s)
By Vignu on Mar 25, 2007 | Reply
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.
By Abhishek on Mar 16, 2009 | Reply
Two or more pointers have their own Data.
class A
{
string c;
}
A a;
B b;
a=b;//deep copy