我如何摆脱“ArrayOfQuoteResult”?

时间:2013-01-22 16:40:13

标签: c# xml xml-serialization xmlserializer

如何离开ArrayOfQuoteResult

我正在序列化List<QuoteResult>,它出现如下,但我不想在Xml文件中使用ArrayOfQuoteResult

请参阅随附的XML回复:

<SearchSchemesResponse xmlns="CompareYourTravelInsurance.Services">
  <SearchSchemesResult>
    <ArrayOfQuoteResult xmlns="">
       <QuoteResult>
          <Currency>GBP</Currency>
          <MedicalCost>36</MedicalCost>
          <PolicyCost>86.06</PolicyCost>
          <PolicyIPT>14.34</PolicyIPT>
          <MyProperty>0</MyProperty>
          <ReturnPage>http</ReturnPage>
          <QuoteRef>328</QuoteRef>
          <PolicyWordingDocumentURL>http</PolicyWordingDocumentURL>
          <KeyFactsDocumentURL>http</KeyFactsDocumentURL>
          <MedicalExpensesExcess>3232</MedicalExpensesExcess>
          <MedicalExpensesCover>444</MedicalExpensesCover>
          <BaggageCover>300</BaggageCover>
          <BaggageExcess>0</BaggageExcess>
          <CancellationCover>500</CancellationCover>
          <CancellationExcess>400</CancellationExcess>
          <DestinationName>test</DestinationName>
          <SchemeName>3694</SchemeName>
          <SchemeDisplayName>Economy Insurefor Direct 2012</SchemeDisplayName>
          <Countries>Sri Lanka,UK</Countries>
          <QuoteRequestRef>8bd1f476-f4e8-4a2b-a489-5291e4adc6f2</QuoteRequestRef>
          <MaxTripDays>60</MaxTripDays>
          <SchemeCoverList>
             <SchemeCover>
                <CoverSectionName>Medical</CoverSectionName>
                <CoverSectionLimit>5000000</CoverSectionLimit>
                <CoverSectionExcess>125</CoverSectionExcess>
             </SchemeCover>
             <SchemeCover>
                <CoverSectionName>Emergency Dental Treatment</CoverSectionName>
                <CoverSectionLimit>350</CoverSectionLimit>
                <CoverSectionExcess>125</CoverSectionExcess>
             </SchemeCover>
          </SchemeCoverList>
       </QuoteResult>
    </ArrayOfQuoteResult>
  </SearchSchemesResult>
</SearchSchemesResponse>

1 个答案:

答案 0 :(得分:1)

使用XmlElement属性装饰属性:

[XmlElement("QuoteResult")]
List<QuoteResult> QuoteResult { get; set; }