C# 深拷贝

mac2022-06-30  16

public static T DeepClone<T>(T obj) { using (var ms = new MemoryStream()) { var formatter = new BinaryFormatter(); formatter.Serialize(ms, obj); ms.Position = 0; return (T) formatter.Deserialize(ms); } }

 

转载于:https://www.cnblogs.com/LLSutdy/p/11475712.html

相关资源:一种c#深拷贝方式完胜java深拷贝(实现上的对比分析)
最新回复(0)