代码
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using (Stream s = (Stream)(new MemoryStream()))
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(s, your_obj);
s.Position = 0;
your_obj_next = (your_obj_type)bf.Deserialize(s);
}