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)); } }
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); } }