我在VS2010 C#中使用了一个web服务。在WSDL中有一些复杂类型,其中一个定义为:
<element name="dsPageInfo">
<complexType>
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="ttPageInfo">
<complexType>
<sequence>
<element name="PageTitle" nillable="true" type="xsd:string"/>
<element name="MetaTitle" nillable="true" type="xsd:string"/>
<element name="MetaDescription" nillable="true" type="xsd:string"/>
<element name="MetaKeywords" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
在VB中定义并调用它:
Dim webService As New myWeb.wsObjClient()
Dim systemType As String
Dim ds(0) As myWeb.dsPageInfoTtPageInfo
webService.Getpageinfo(systemType, ds)
C#中的Dim ds(0) As myWeb.dsPageInfoTtPageInfo
相当于什么?
到目前为止,我有:
string systemType = "mySysType";
myWeb.wsObjClient webService = new myWeb.wsObjClient();
webSevice.Getpageinfo (
systemType,
// complex type goes here);
答案 0 :(得分:1)
这是在C#中创建数组的等效项
myWeb.dsPageInfoTtPageInfo[] ds= new myWeb.dsPageInfoTtPageInfo[1]
ds[0]= new dsPageInfoTtPageInfo();
webSevice.Getpageinfo (systemType,ds);