views:

1494

answers:

3

Does WCF support generic collections? I looked at the proxy object, and it seems to generate object array from a generic list collection.

Thanks

+3  A: 

WCF does support generic collections. Over the wire it is transfered as an array of objects (this is the standard way of sending lists/arrays/etc), but WCF does the serialization/deserialization for you, so as far as your client/server are concerned, the collections are generic.

Edit: a caveat is, of course, that the collection has to be serializable. Also, take a look at this if you asking your question because your custom collection is being treated as an T[] on the client.

siz
+1  A: 

Using generics are fine as long as you are using WCF at both ends. If you haven't already; you must carefully consider the scenarios where a non-wcf client might need to use your services.

Hemant
+1  A: 

When you add/edit the service client, if you click on the "Advanced ..." button you will see an option allowing you to choose the collection type your service client will create. The default is System.Array, but you can change it to System.Collections.Generic.List (along with many other choices).

http://msdn.microsoft.com/en-us/library/bb514724.aspx

Eric King