【发布时间】:2011-03-10 17:39:41
【问题描述】:
我正在使用 Visual Studio 2010,并且我有一个对我们创建的 Web 服务的服务引用。我们的方法返回包含通用 List 属性的对象:
public class ExampleResponse
{
private System.Collections.Generic.List<int> intValues;
[WCF::MessageBodyMember(Name = "IntValues")]
public System.Collections.Generic.List<int> IntValues
{
get { return intValues; }
set { intValues= value; }
}
}
在客户端,它使用 int[] 而不是 List 创建一个 References.cs 文件:
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="SomeNamespace", Order=0)]
[System.Xml.Serialization.XmlArrayAttribute(IsNullable=true)]
[System.Xml.Serialization.XmlArrayItemAttribute(Namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays", IsNullable=false)]
public int[] IntValues;
在服务引用设置中,集合类型设置为使用列表,而不是数组。然而,它仍在这样做。
任何有关如何解决此问题的信息都会非常有帮助,但似乎没有任何意义。
【问题讨论】:
标签: c# web-services