protobuf-net是否支持System.Collections.Queue?

时间:2012-09-24 18:11:29

标签: c# .net protobuf-net

我使用protobuf-net而不是binaryformatter运行我的客户端/服务器应用程序,然后我得到下一个异常:“没有为类型定义序列化程序: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且具有Add(T)方法的类型 和队列http://msdn.microsoft.com/en-us/library/system.collections.queue.aspx没有添加(T)...

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

1 个答案:

答案 0 :(得分:1)

目前,没有:它没有。我建议将数据作为序列化列表进行处理。作为参考,XmlSerializer也讨厌它 - 这是XmlSerializer的{​​{1}}输出:

  

“您必须在System.Collections.Generic.Queue`1 [[System.String,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089]]上实现默认访问者,因为它继承自ICollection。”

相关问题