Using Generic List<T> From WCF Services
I've had a lot of traffic to a post from a while back on "Make Your Web Service Proxies Return List<T> Using RegEx (And The Regulator)". In the post, I was converting the arrays that were being generated by the web client proxy into List<T> (Or List(Of T) if you speak VB) and I was using RegEx to do. It was a bit tricky because I had to ignore the object[] arrays that were being used internally in the proxy class and it was a bit kludgy because it had to be run by hand every time you updated the proxy. Later on, I had a follow up for WCF proxies, but it required you to generate your proxy via the command line.
With Visual Studio 2008 and WCF, these problems go away, but you've got to know how to do it. VS 2008 no longer offers an "Add Web Reference" option - it only gives you an "Add Service Reference" (at least that's if you're using a .net 3.0 or later project) which generates a WCF proxy. When you add a service proxy reference, the trick is to open up the Advanced Options:
On the window that loads up, there is a "Collection type" setting (and a "Dictionary collection type" as well if you need that). On this drop down list, simply chance the type to System.Collections.Generic.List:
Updating an Existing Service Reference
If you've already got an existing service reference and you want to change it now to using a List<T>, right click on it and select Configure Service Reference:
When you do this, a window similar to the Service Reference Settings window from above appears, allowing you to do the same as before:
