分享 在内存中序列化反序列化对象实现对象的深拷贝

  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);

                }

 

 


using System.Runtime.Serialization.Formatters.Binary;

using System.IO;


jeck猫
浏览 541回答 1
1回答

牛魔王的故事

using (Stream s = (Stream)(new MemoryStream()))可以用using (Stream s = (new MemoryStream()))强转型时多余的另外不是提问请发小组……
打开App,查看更多内容
随时随地看视频慕课网APP