Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generic collection support in WCF

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

Thanks

like image 838
Jeremy Thomson Avatar asked Mar 07 '09 01:03

Jeremy Thomson


People also ask

In which version of .NET generic collection is introduced?

NET 2.0 has introduced a new namespace called System. Collections. Generic which contains classes that support generics.

Which interface defines methods to control the different generic collections?

NET class library defines several generic interfaces for use with the collection classes in the System. Collections. Generic namespace.

What namespace contains generic classes and interfaces?

Generic namespace. This namespace contains interfaces and classes that define generic collections and operations. All the generic collections implement a series of generic interfaces, which are also defined in this namespace.


1 Answers

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.

like image 195
Szymon Rozga Avatar answered Sep 25 '22 09:09

Szymon Rozga