Easy method to make deep copies without [serializable]

时间:2016-08-31 12:34:02

标签: c# reflection clone deep-copy

I have a class that I want to make a deep copy off, however it contains many attributes some of which contains other attributes. Now normally we can use either a clone or serialize method such as seen in How do you do a deep copy an object in .Net (C# specifically)? in order to get a good copy. However in my case several of these attributes come from a library which did not mark anything as either serializable or clonable.

Anybody know how to fix this? Something with reflection? Something efficient?

Also I know that parts of the program is going to be cyclicity linked and that there are private variables in the library.

0 个答案:

没有答案