简体   繁体   English

名称冲突? 'System.Array'不包含'item'的定义

[英]Name Conflict? 'System.Array' does not contain a definition for 'item'

I am using a webservice (provided by webservices.nl) to extract company data depending on a company number. 我正在使用Web服务(由webservices.nl提供)根据公司编号提取公司数据。

myserviceBusiness = new nl.webservices.ws1.Webservicesnl();

nl.webservices.ws1.BusinessDossierV3PagedResult result = null;
result = myserviceBusiness.businessGetDossierV3(KVKnr, "0000", 1);

string address = result.results.item.EstablishmentPostcode;

VS underlines only "item" in curly red line Error/ 'System.Array' does not contain a definition for 'item' and no extension method 'item' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?) VS仅在红色红线下划线“错误” /“System.Array”不包含“ item”的定义,找不到扩展方法“ item”接受类型为“ System.Array”的第一个参数(您是缺少using指令或程序集引用?)

So the problem is that intellisense doesn't recognize item and also streetname. 因此,问题在于智能感知无法识别项目,也无法识别街道名称。 When I take something else from that message, it works : 当我从该消息中获取其他内容时,它会起作用:

 string page = result.paging.curpage;

the response soap message looks like this: 响应消息如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<businessGetDossierV3Response xmlns="http://www.webservices.nl/soap/">
<out>
<paging>
<curpage>1</curpage>
<perpage>10</perpage>
<numpages>1</numpages>
<numresults>1</numresults>
<maxresults>100</maxresults>
</paging>
<results>
<item>
<RegisterLetter>H</RegisterLetter>
<DossierNo>50085980</DossierNo>
<SubDossierNo>0000</SubDossierNo>
<ChamberNo></ChamberNo>
<Legalformcode></Legalformcode>
<LegalformcodeText></LegalformcodeText>
<Tradename45></Tradename45>
<TradenameFull></TradenameFull>
<EstablishmentPostcode></EstablishmentPostcode>
<EstablishmentCity></EstablishmentCity>
<EstablishmentStreetname></EstablishmentStreetname>
<EstablishmentHouseNo></EstablishmentHouseNo>
<CorrespondencePostcode></CorrespondencePostcode>
<CorrespondenceCity></CorrespondenceCity>
<CorrespondenceStreetname></CorrespondenceStreetname>
<CorrespondenceHouseNo>97</CorrespondenceHouseNo>
</item>
</results>
</out>
</businessGetDossierV3Response>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Is this a name conflit problem ? 这是名称冲突的问题吗? If yes, how can I resolve it ? 如果是,我该如何解决? If not, how can i extract the data in the results part? 如果没有,我如何提取结果部分中的数据?

The service is returning an array of results instead of a single result. 该服务将返回结果数组,而不是单个结果。 Use this instead: 使用此代替:

string address = result.results[0].EstablishmentPostcode;

我认为item是数组索引器的占位符,因此您可能要输入:

string address = result.results[ 0 ].EstablishmentPostcode;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM