public void AddProduct() { string chon = string.Empty; Cls_Product _product; do { _product = new Cls_Product(); _product.Input(); _ListProduct.Add(_product); Console.WriteLine("Ban co muon nhap tiep khong Y/N"); chon = Console.ReadLine(); } while (chon.ToLower().Equals("y")); }
public void ReadForFile(string path) { _ListProduct.Clear(); using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (BinaryReader bW = new BinaryReader(fs)) { Cls_Product _product; while (bW.PeekChar() != -1) { _product = new Cls_Product(); _product.ReadForFile(bW); _ListProduct.Add(_product); } } } }