How do you do a deep copy of an object in .NET? [duplicate]
Important Note BinaryFormatter has been deprecated, and will no longer be available in .NET after November 2023. See BinaryFormatter Obsoletion Strategy I’ve seen a few different approaches to this, but I use a generic utility method as such: public static T DeepClone<T>(this T obj) { using (var ms = new MemoryStream()) { var formatter = … Read more