Tutorial :C5 collection library - serialization problem over WCF



Question:

I am trying to send a TreeDictionary from the C5 collection library over WCF. It gets to the recipient OK (I had to add a lot of KnownType attributes for what seems to be internal data structures). However, now I am stuck at a point where it fails because it cannot create a default comparer for C5.KeyValuePair'2[typea,typeb].

Is this because the C5 classes inherently cannot go across WCF (and I am lucky to have got this far) or something else?


Solution:1

C5 classes are indeed not designed to go across a serialization boundary. You have several options.

  1. Add a reference to the C5 libraries on your client side. This is not service oriented and will not work on anything but a .NET client at best. Not recommended.
  2. If possible, convert the dictionary to a regular .NET dictionary and return that. Your client ought to be able to receive this.

Good luck!


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »