Welcome to the Dot Net Tech Community

Experience The Freedom To Share...

Tuesday, December 28, 2010

Generic List as return type in WCF

Dear Readers, One of the common problem in WCF is returning lists in the service. When we return a Lin our serivce and generate a proxy for that we will be seeing an array in the Proxy generated, this is because by default all the collections are interpreted as arrays.

solution is while creating proxy incluse /ct: in the ending along with the Name space for the list, which inturn will change the proxy make the return type as list.Please find the below mentioned systax for the SVCUtil.exe

svcutil.exe http://[SERVER]/[Namespace].[Service].svc?wsdl /ct:System.Collections.Generic.List`1
[Note: Do not excude `1 in the ending]