Skip to content

Instantly share code, notes, and snippets.

@dkalamari
Last active December 17, 2015 01:58
Show Gist options
  • Save dkalamari/5531774 to your computer and use it in GitHub Desktop.
Save dkalamari/5531774 to your computer and use it in GitHub Desktop.
Deep copy
public clsDeep CreateDeepCopy(clsDeep inputcls)
{
MemoryStream m = new MemoryStream();
BinaryFormatter b = new BinaryFormatter();
b.Serialize(m, inputcls);
m.Position = 0;
return (clsDeep)b.Deserialize(m);
}
//USE
clsDeep m2 = objdeep.CreateDeepCopy(objdeep);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment