private void button16_Click(object sender, EventArgs e) { ObjTest t = new ObjTest(); t.age = 10; t.name = "张三"; t.birthday = DateTime.Now; t.sex = false; List <Child> children = new List <Child>(); children.Add(new Child()); children.Add(new Child()); t.children = children; t.strs = new List <string>(); t.strs.Add("aaa"); t.strs.Add("bbb"); FileUtils.SerializeXmlFile <ObjTest>(t, "e:\\220.xml"); }
private void button15_Click(object sender, EventArgs e) { ObjTest obj = FileUtils.DeserializeXmlFile <ObjTest>("e:\\210.xml"); MessageBox.Show(obj.birthday.ToString()); }