开发者

Serialization Exception

what is Exception "End of Stream encountered before parsing was completed." in the my code?

BinaryFormatter t = new BinaryFormatter();
MemoryStream n = new MemoryStream();
t.Serialize(n, j)开发者_JAVA技巧;

BinaryFormatter q = new BinaryFormatter();
MemoryStream x = new MemoryStream();
q.Deserialize(n);


After serializing the object to the stream, the stream's Position is at the end.
Therefore, there is nothing more in the stream for the deserializer to read.

You need to rewind the stream, by setting n.Position = 0.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜