Exemplo n.º 1
0
        static void Main(string[] args)
        {
            List <PC> pc_s = new List <PC>()
            {
                new PC()
                {
                    Brand = "Asus", SerialNUmber = "SN005", Type = "Game"
                },
                new PC()
                {
                    Brand = "HP", SerialNUmber = "SN015", Type = "Home"
                },
                new PC()
                {
                    Brand = "Dell", SerialNUmber = "SN105", Type = "Office"
                },
                new PC()
                {
                    Brand = "Intel", SerialNUmber = "SN022", Type = "Office"
                }
            };

            DoSerialize.Write(pc_s, "PC*.txt");   // для кожного обєкту в ліст окремий тхт
            Serialize.SaveFile("Test.bin", pc_s); // сереаліазуєм масив
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            List <PC> list1 = Deserialize.ReadFile(@"..\..\..\Transfer\bin\Debug\Test.bin"); //ох і намучився з цим шляхом

            foreach (PC item in list1)
            {
                View.Show(item);
            }


            List <PC> list2 = DoSerialize.Read(@"..\..\..\Transfer\bin\Debug\PC*.txt"); // інший спосіб десереалізації

            Console.WriteLine();
            foreach (PC item in list2)
            {
                View.Show(item);
            }
            Console.ReadKey();
        }