什么是异常“在解析完成之前遇到的流结束。”在我的代码中?
BinaryFormatter t = new BinaryFormatter();
MemoryStream n = new MemoryStream();
t.Serialize(n, j);
BinaryFormatter q = new BinaryFormatter();
MemoryStream x = new MemoryStream();
q.Deserialize(n);
答案 0 :(得分:3)
将对象序列化到流后,流的Position
就在最后
因此,流中没有更多内容可供解串器读取。
您需要设置n.Position = 0
。