对第三方的服务引用使用数组而不是通用列表
我看到与我的问题相关的类似帖子,但没有找到答案。我有一个简单的类库,其中包含此亚马逊服务的“服务引用”: http:// webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl 在我的 Visual Studio 2010 项目中。该项目正在使用“.Net Framework 4”配置文件。同样,这是“服务参考”而不是老式的“网络参考”。我已经进入高级选项并告诉它使用“System.Collections.Generic.List”作为“集合类型”,但它忽略了这一点并使用数组来处理所有内容。
如何让 Visual Studio 2010 为该特定服务生成代理并使其使用通用列表?是否有命令行会在生成过程中强制执行此操作?
我不想要的示例:
private ItemLink[] itemLinksField;
我希望代理生成器生成什么:
private List<ItemLink> itemLinksField;
I saw similar posts related to my problem but found no answer. I've got a simple class library with a "service reference" to this amazon service: http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl in my visual studio 2010 project. The project is using ".Net Framework 4" profile. Again this is a "service reference" NOT the old school "web reference". I've gone into the advanced options and told it to use "System.Collections.Generic.List" as the "collection type" but it ignores this and uses arrays for everything.
How do I get visual studio 2010 to generate a proxy for this particular service and get it to use generic lists? Are there command lines that will force this during the generation?
Example of what what I do NOT want:
private ItemLink[] itemLinksField;
What I want the proxy generator to produce:
private List<ItemLink> itemLinksField;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能这样做,但是有一种简单的方法可以仅用一行代码将对象数组转换为列表。看我的示例代码:
You can't do this, however there is simple way how to convert array of objects to list in just one line of code. See my sample code: