Why does WCF return myObject [] instead of List <T> as I expected?
I am returning a List from my WCF method. In my client code, the return type is displayed as MyObject []. I should either use MyObject [], or IList, or IEnumerable ...
WCFClient myClient = new WCFClient(); MyObject[] list = myClient.GetMyStuff(); or IList<MyObject> list = myClient.GetMyStuff(); or IEnumerable<MyObject> list = myClient.GetMyStuff(); All I do is collect this collection and snap it to the grid. What is the best object for assigning my returned collection?
You can specify that you want to use the general list instead of an array by clicking the "Advanced" button when you add the link, or you can right-click the link to the service and select "configure" to change it in place.
The reason is that WCF serializes shared lists as arrays for wire transfers. The configuration simply tells svcutil to create a proxy server that converts them back to a shared list for your convenience.

When you use svcutil.exe to create your client code, you need to tell it how to resolve certain links that are not available to it.
Here's how you do it for List<T> :
svcutil /o:YourService.cs /ct:System.Collections.Generic.List`1 http://example.com/mex Stever B is true. WCF is very difficult not to connect to .NET. You can allow the Java client to connect to your component. Arrays are compatible. Common .NET lists are not.
However, you can more than create your own proxy class that converts the array back to a list or something else you need. The best part is that you manually create your own proxies, so that you have full control over what they do.
When you add a service link to a client project, click the "Advanced" button and change the type of the collection from the array to whatever you want ...