深复制一个.NET类实例,而不序列化 [英] Deep Copy a .NET Class Instance Without Serialization

查看:162
本文介绍了深复制一个.NET类实例,而不序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用来自第三方的DLL类的实例,我需要做的深层副本在特定的实例。该类没有标记为序列化,所以我不能使用<一个href="http://stackoverflow.com/questions/129389/how-do-you-do-a-deep-copy-an-object-in-net-c-specifically">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.

这篇关于深复制一个.NET类实例,而不序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆