示例#1
0
文件: Form1.cs 项目: LisP94/OOP
 private void button7_Click(object sender, EventArgs e)
 {
     var textSerializer = new Serializer(typesname);
     using (var fileStream = new FileStream("TextSerialize.Txt", FileMode.Open))
     {
         var stream = new StreamReader(fileStream);
         productList = (List<Product>)textSerializer.Deserialize(stream);
         treeView1.Nodes.Clear();
         treeView1.Nodes.Add(TreeBuilder.GetTree(productList));
     }
 }
示例#2
0
文件: Form1.cs 项目: LisP94/OOP
 private void button6_Click(object sender, EventArgs e)
 {
     var textSerializer = new Serializer(typesname);
     using (var fileStream = new FileStream("TextSerialize.Txt", FileMode.Create))
     {
         var stream = new StreamWriter(fileStream) { AutoFlush = true };
         textSerializer.Serialize(stream, productList);
     }
 }