XML Version = "1.0" encoding = "UTF-8"?>
Private void button3_click (object sender, system.eventargs e) {// object serialized output for XML
XMLSerializer AXML = New XMLSERIALIZER (CLSTEST CLS = New Clstest (); ROM ROM = New Room (); rom.in = 3; rom.iq = 4; cls.myroom = rom; // Create File For Writing Out Textwriter Writer = New StreamWriter (@ "f: /order.xml", false, system.text.encoding.getencoding ("GB2312")); // Serialize Data To file
Axml.Serialize (Writer, CLS); Writer.close ();} ---------------------------------- -------------------------------------------------- ------------------------- There is another problem XML Version = "1.0" encoding = "UTF-8"?>
Change to:
[XMLROOT ("test")] public class clstest {public room [] myroom; // use array}
Serialization: ROOM ROM1 = New Room (); rom1.in = 3; rom1.iq = 4;