Created
August 8, 2018 07:23
-
-
Save Hribek25/4b5007b0da4b387a2aab3e0d82144ccd to your computer and use it in GitHub Desktop.
BinaryFormatter.Serialize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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