Exemplo n.º 1
0
Arquivo: Form1.cs Projeto: 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));
     }
 }
Exemplo n.º 2
0
Arquivo: Form1.cs Projeto: 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);
     }
 }