7
は、私はこのXMLシリアル化配列は、私が困っこれを考え出すを抱えている
<root>
<list id="1" title="One">
<word>TEST1</word>
<word>TEST2</word>
<word>TEST3</word>
<word>TEST4</word>
<word>TEST5</word>
<word>TEST6</word>
</list>
<list id="2" title="Two">
<word>TEST1</word>
<word>TEST2</word>
<word>TEST3</word>
<word>TEST4</word>
<word>TEST5</word>
<word>TEST6</word>
</list>
</root>
ようなXMLシートを持っていると私は
public class Items
{
[XmlAttribute("id")]
public string ID { get; set; }
[XmlAttribute("title")]
public string Title { get; set; }
//I don't know what to do for this
[Xml... something]
public list<string> Words { get; set; }
}
//I don't this this is right either
[XmlRoot("root")]
public class Lists
{
[XmlArray("list")]
[XmlArrayItem("word")]
public List<Items> Get { get; set; }
}
//Deserialize XML to Lists Class
using (Stream s = File.OpenRead("myfile.xml"))
{
Lists myLists = (Lists) new XmlSerializer(typeof (Lists)).Deserialize(s);
}
私にそれをシリアル化しようとしていますXMLとXMLのシリアライズでは本当に新しいです。どんな助けでも大いに感謝します
言葉プロパティの使用XmlArrayとして動作するはずです – sll
XMLのオブジェクトをオブジェクトに変換する場合は、デシリアライズしてください。オブジェクトをXML(またはディスクやネットワークスチームに送ることができるその他の形式)に変換することは、シリアル化しています。 – MCattle