Justin
Justin

Reputation: 6559

Serializable key value pair or tuple in silverlight

I need to send a list of key value pairs or tuples to a silverlight application from WCF. I have found that the KeyValuePair class is not serializable and the tuples class is also not serializable in silverlight.

I read a blog post about this found here: http://davybrion.com/blog/2010/06/more-on-system-tuple-and-serializationdeserialization/

That also had some responses from other blogs. I went to one of them found here: http://www.devvblog.com/?p=5

But I don't really understand how to use it. I expected I could do Tuple<double> temp = new Tuple();. However, there doesn't seem to be a default constructor. If anyone knows how to use this, please explain. Otherwise, is there a way I can simply send a list of object pairs from WCF to a silverlight app?

Upvotes: 0

Views: 1442

Answers (1)

Stewart Sweet
Stewart Sweet

Reputation: 66

I favor the custom struct solution described in this similar question. Easy to use and easy to understand.

Is there a serializable generic Key/Value pair class in .NET?

Upvotes: 1

Related Questions