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
One suggestion is to use Json serialization (which uses reflection, and doesn't rely on the [Serializable]
attribute) to serialize and deserialize into a copy. For example, using the Json.Net library:
var copiedObject = JsonConvert.DeserializeObject(
JsonConvert.SerializeObject(sourceSnapshotObject));