Имеется код :
public class MemorySerializer
{
static MemoryStream ms = new MemoryStream();
public static void Serializer(object item)
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, item);
}
public static object Deserialize()
{
BinaryFormatter bf = new BinaryFormatter();
object obj = bf.Deserialize(ms);
return obj;
}
}