0
我有下面列出的xml。我想反序列化到C#中的列表<>。有沒有辦法處理列表實體名稱ASIwizard和嚮導的加倍?如果它只是ASIwizard或嚮導,我可以做到,但我不知道如果每個元素都有雙重名稱,該怎麼辦?如何反序列化具有雙重實體名稱的列表?
<ASiwizards>
<ASiwizard>
<Wizard>
<id>1</id>
<title>Headlight Wizard</title>
<description>This wizard will help troubleshoot issues related to the headlight functionality of the eBike controller</description>
<created>2012-04-27 14:35:34</created>
<modified>2012-04-27 14:35:34</modified>
</Wizard>
</ASiwizard>
<ASiwizard>
<Wizard>
<id>2</id>
<title>Wiring Harness</title>
<description/>
<created>2012-04-27 19:11:33</created>
<modified>2012-04-27 19:11:33</modified>
</Wizard>
</ASiwizard>
</ASiwizards>
你知道我會添加到這個公共類ASiwizards { [的XmlElement( 「嚮導」) 公開名單奇才; } namespace WizardList { public class Wizard { public int id; public String title; public String description; } } –
DonRobb
@DonRobb:你應該更新你的問題來澄清它。看起來你想使用'XmlSerializer',你也應該添加你在評論中寫的代碼片段。我可能不得不刪除我的答案。 –