Shi*_*iji 4 c# code-generation svcutil.exe
我试图用svcutil自动生成一些代码.我在xsd中有以下内容:
<xs:complexType name="ForsikringstilfelleDetalj">
<xs:sequence>
<xs:element name="detaljID" type="xs:string" minOccurs="0" maxOccurs="1"/>
Run Code Online (Sandbox Code Playgroud)
然后我运行以下命令:
svcutil xx.wsdl yy.xsd /ct:System.Collections.Generic.List`1
Run Code Online (Sandbox Code Playgroud)
然后我得到以下C#代码:
public ForsikringstilfelleDetalj[] forsikringstilfelle
Run Code Online (Sandbox Code Playgroud)
我想要的是:
public List<ForsikringstilfelleDetalj> forsikringstilfelle
Run Code Online (Sandbox Code Playgroud)
根据网上的信息,/ ct选项应告诉svcutil使用通用列表进行集合.谁能看到我做错了什么?
要将元数据(包括xsd方案)下载到当前目录,请使用:
svcutil /t:metadata http://.../.../service?WSDL
Run Code Online (Sandbox Code Playgroud)要生成客户端代码,请使用:
svcutil *.wsdl *.xsd /language:C# /ct:System.Collections.Generic.List`1
Run Code Online (Sandbox Code Playgroud)
注意:*.wsdl和*.xsd因为可能有很多服务定义和方案.
要一步生成客户端代码,请使用:
svcutil http://.../.../service?WSDL /ct:System.Collections.Generic.List`1
Run Code Online (Sandbox Code Playgroud)