深复制一个.NET类实例,而不序列化而不、实例、序列化、NET

2023-09-03 07:16:22 作者:欲望养厉鬼

我使用来自第三方的DLL类的实例,我需要做的深层副本在特定的实例。该类没有标记为序列化,所以我不能使用this使用建议的方法的BinaryFormatter

I am using an instance class from a third-party DLL, and I need to do a deep copy on a particular instance. The class is not marked as Serializable, and therefore I can not use this suggested method using BinaryFormatter.

我如何能得到这个对象的深层副本,而不使用序列?

How can I get a deep copy of this object without using serialization?

推荐答案

我一直使用拷贝的大获成功。它使用反射罩下。它是开源的。请务必阅读局限性和缺陷的,看看你可以使用它。

I've been using Copyable with great success. It uses reflection under the hood. It is open-sourced. Be sure to read Limitations and pitfalls to see if you can use it.

 
精彩推荐
图片推荐