Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
int count = deserializer.Deserialize(fileStream);
不能将类型“object”隐式转换为“int”。存在显式转换(您是否缺少演员表?)
尝试int count = (int)deserializer.Deserialize(fileStream);
int count = (int)deserializer.Deserialize(fileStream);
如果它确实是一个Int32,你可以这样做:
Int32
序列化程序在编译时不知道它们正在反序列化什么类型,因此该方法将返回一个对象。您必须将该对象转换为实际类型。