如何将一个Dictionary<string,object>序列化成byte-CSDN论坛
1个回答
展开全部
Dictionary<string, string> dic1= new Dictionary<string, string>();
dic1.Add("1", "1");
dic1.Add("2", "2");
MemoryStream ms = new MemoryStream();
bf.Serialize(ms, dic1);
byte[] buffer = ms.GetBuffer();
MemoryStream ms1 = new MemoryStream(buffer);
Dictionary<string, string> dic2= (Dictionary<string, string>)bf.Deserialize(ms1);
dic1.Add("1", "1");
dic1.Add("2", "2");
MemoryStream ms = new MemoryStream();
bf.Serialize(ms, dic1);
byte[] buffer = ms.GetBuffer();
MemoryStream ms1 = new MemoryStream(buffer);
Dictionary<string, string> dic2= (Dictionary<string, string>)bf.Deserialize(ms1);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询