Why does my WCF service return and ARRAY instead of a List ?

后端 未结 3 1653
面向向阳花
面向向阳花 2020-12-10 12:44

In the web servce I say

 public List GetCustomers()
    {
        PR1Entities dc = new PR1Entities();
        var q = (from x in dc.Customers         


        
3条回答
  •  伪装坚强ぢ
    2020-12-10 13:25

    Right click on the service reference and select Configure Service Reference.

    In the Collection Type drop-down, select the type System.Collections.Generic.List.

    I believe the reason it defaults to Array is that it is the most compatible when serializing. If you're consuming the service from something that recognizes something more complex, you can configure as I mentioned.

提交回复
热议问题