2012-09-24 184 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同樣適用,雖然;另外增加的複雜性*另外*與非泛型類型,我們還需要告訴它我們應該期待什麼樣的項目類型 –