コード例 #1
0
ファイル: Program.cs プロジェクト: doroh228/Mylabs_oop
        static void Main(string[] args)
        {
            try
            {
                Mylist <Product> product1 = new Mylist <Product>();


                Product prod1 = new Product("Банан", 100, 100);
                Product prod2 = new Product("Яблоко", 150, 90);
                product1.AddItem(prod1);
                product1.AddItem(prod2);
                Console.WriteLine(product1);
                Console.WriteLine();
                product1.Show();


                FileStream   file   = new FileStream("d:\\kurs\\LABS\\infotext.txt", FileMode.Create);
                StreamWriter writer = new StreamWriter(file);
                writer.Write(prod1.ToString());
                writer.Write("\n");
                writer.Write(prod2.ToString());
                writer.Write("\n");
                writer.Close();
                FileStream   file1  = new FileStream("d:\\kurs\\LABS\\infotext.txt", FileMode.Open);
                StreamReader reader = new StreamReader(file);
                Console.WriteLine(reader.ReadToEnd());
                reader.Close();
            }
            finally
            {
                Console.WriteLine("End");
            }
        }