gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 13:54:53 25 4
gpt4 key购买 nike

我使用 protobuf-net 而不是 binaryformatter 运行我的客户端/服务器应用程序,我得到下一个异常:“No serializer defined for type: System.Collections.Queue”。我不太确定,可能是因为我做错了什么......因为我已经询问过字典/列表并且支持这些类型(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没有 Add(T)...

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

最佳答案

目前,不:它没有。我建议将数据视为序列化目的的列表。作为引用,XmlSerializer也讨厌它 - 这是 XmlSerializer Queue<string> 的输出:

"You must implement a default accessor on System.Collections.Generic.Queue`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] because it inherits from ICollection."

关于c# - protobuf-net 是否支持 System.Collections.Queue?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12570496/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com