为什么我的WCF服务返回而ARRAY而不是List <T>?

pun*_*ter 13 asp.net generics wcf

在网络服务我说

 public List<Customer> GetCustomers()
    {
        PR1Entities dc = new PR1Entities();
        var q = (from x in dc.Customers
                select x).ToList();
        return q;
    }
Run Code Online (Sandbox Code Playgroud)

(客户是实体对象)

然后我在添加服务时生成代理..并在reference.cd中说

public wcf1.ServiceReference1.Customer[] GetCustomers() {
        return base.Channel.GetCustomers();
    }
Run Code Online (Sandbox Code Playgroud)

为什么是阵列?我要了一份清单.

救命.

Gre*_*gen 30

右键单击服务引用,然后选择"配置服务引用".

在"集合类型"下拉列表中,选择"System.Collections.Generic.List"类型.

我相信它默认为Array的原因是它在序列化时是最兼容的.如果您从识别更复杂的东西中获取服务,则可以按照我的提法进行配置.