2012-09-24 91 views
2

我使用protobuf-net而不是binaryformatter运行我的客户端/服务器应用程序,并且我得到下一个异常:“No serializer defined for type:System.Collections.Queue”。 我不确定是否完全,可能是原因是我做错了什么... ,因为我已经问过Dictionary/List,并且支持这些类型(Can I serialize an object (containing members: Dictionary, List... etc) in Mono and deserialize it in MS.NET or vice versa by using protobuf-net?)。 http://code.google.com/p/protobuf-net/wiki/GettingStarted “支持: 其实现IEnumerable并具有添加(T)方法任何类型的”protobuf-net是否支持System.Collections.Queue?

我刚刚从读 和队列http://msdn.microsoft.com/en-us/library/system.collections.queue.aspx没有添加(T)...

问题: 但我想确保完全。 protobuf-net是否支持System.Collections.Queue

回答

1

在当前时间,否:不。我建议将数据视为序列化目录列表。作为参考,XmlSerializer讨厌它太 - 这里是XmlSerializer输出Queue<string>

“你必须实现在System.Collections.Generic.Queue`1默认访问[System.String,mscorlib程序,版本= 4.0。 0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089]],因为它继承自ICollection。“

+0

谢谢你的回复。 –

+0

这个问题似乎是关于非通用的“队列”,而不是通用的“队列”。 – svick

+0

@svick同样适用,虽然;另外增加的复杂性*另外*与非泛型类型,我们还需要告诉它我们应该期待什么样的项目类型 –