Skip to content

Instantly share code, notes, and snippets.

@Hribek25
Created August 8, 2018 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hribek25/4b5007b0da4b387a2aab3e0d82144ccd to your computer and use it in GitHub Desktop.
Save Hribek25/4b5007b0da4b387a2aab3e0d82144ccd to your computer and use it in GitHub Desktop.
BinaryFormatter.Serialize
private byte[] ObjectToByteArray(Object obj)
{
using (var ms = new MemoryStream())
{
BinaryFormatter b = new BinaryFormatter();
b.Serialize(ms, obj);
return ms.ToArray();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment