rendered paste body public static void Serialize()
{
try
{
byte[] byteMap = CompressMyObject(myMap);
Stream stream = File.Open(@"C:\blah.dat", FileMode.Create);
BinaryFormatter bFormatter = new BinaryFormatter();
bFormatter.Serialize(stream, byteMap);
stream.Close();
bFormatter = null;
}
catch (InvalidOperationException e)
{
MessageBox.Show(e.ToString());
}
}
public static void Deserialize()
{
try
{
byte[] byteMap;
Stream stream = File.Open(@"C:\blah.dat", FileMode.Open);
BinaryFormatter bFormatter = new BinaryFormatter();
byteMap = (byte[])bFormatter.Deserialize(stream);
myMap = DecompressMyObject(byteMap);
stream.Close();
bFormatter = null;
}
catch (InvalidOperationException e)
{
MessageBox.Show(e.ToString());
}
}