Home
Manage Your Code
Snippet: Binary serialization method (C#)
Title: Binary serialization method Language: C#
Description: A method to Serialize a object to a MemoryStream using the BinaryFormatter. Views: 69
Author: Schalk van Wyk Date Added: 8/26/2008
Copy Code  
1public Stream Serialize()
2{
3    //Use Version Tolerant Serialization cocepts

4    BinaryFormatter formatter = new BinaryFormatter();
5
6    MemoryStream stream = new MemoryStream();
7
8    formatter.Serialize(stream, this);
9    stream.Position = 0;
10
11    return stream;
12}