Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending a Tuple object over WCF?

Is the System.Tuple class supported by WCF's Data Contract Serializer (i.e., can I pass Tuple objects to WCF calls and/or receive them as part or all of the result)?

I found this page, but not the clear, definitive "you can send and receive Tuples with WCF" answer I was hoping for.

I'm guessing that you can, as long as all of the types within the Tuple itself are supported by the Data Contract Serializer -- can anyone provide me with a more definitive answer? Thanks.

like image 643
Donut Avatar asked Apr 28 '10 20:04

Donut


1 Answers

The Tuple types are marked with SerializableAttribute, therefore, if the types you store within are serializable, they should be able to be serialized by WCF as well.

Check out: links of Tuple'1, Tuple'2, etc. It says:

[SerializableAttribute]
public class Tuple<T1> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple

Note that the document you linked contains the following line:

The [Serializable] / ISerializable programming model is not supported in a partial trust environment.

So, it may not be as easy as it would seem.

(BTW, the Tuple static class is also worth checking out.)

like image 100
Venemo Avatar answered Sep 17 '22 22:09

Venemo