System.Collections.Generic.List datatype converting to Object Array

I have a property defined in a Webservices using System.Collections.Generic.List datatype. When that web service is referenced in my windows application, I see in the reference.cs file that the datatype is changed to an object Array. But I want the same datatype defined in the Web Services as i want to use the Add functionality of the List Datatype. Any solution for the issue.
Thanx in Advance.


Answer this question

System.Collections.Generic.List datatype converting to Object Array

  • F15HER

    Hi Parimal,

    Have a look at the following thread: Generic List get converted into an Array when sent through Web Service

    Hope it helps!

    ~JD


  • kfhoz

    Parimal wrote:
    I have a property defined in a Webservices using System.Collections.Generic.List datatype. When that web service is referenced in my windows application, I see in the reference.cs file that the datatype is changed to an object Array. But I want the same datatype defined in the Web Services as i want to use the Add functionality of the List Datatype. Any solution for the issue.
    Thanx in Advance.

    if you want to have the generics data types on the client you will have to write a bit of code to make that happen.

    My understanding is that the SOAP / WSDL / Web Services / XML specs do not have .net CLR genercis in them as web services need to interop with other systems that may not have generics or may have a different way of expressing them.

    so for example a Java client would not "know" what List<foo> was but will understand

    foo[] as a valid type of data.

    perhaps in a later revision of the specs they may add some form of support for generics.


  • Roadkill

    Thanx for the reply.

    I want to know what code should I write to have the above mentioned datatype on Client side.

    Thanx in Advance.


  • System.Collections.Generic.List datatype converting to Object Array