コード例 #1
0
        static void Main(string[] args)
        {
            List <MyObject> listObjects = new List <MyObject>();
            Agency          agency      = new Agency();
            bool            clearFile   = WriteToFile.ClearFile();

            int[] mass = MyObject.checkFile();

            while (mass[0] != mass[1])
            {
                MyObject myObject = new MyObject(agency);
                mass[0]++;
            }

            ReadFromFile.Read(ref listObjects);
            Console.WriteLine();
            Console.Write("Агенство недвижимости ");
            Console.WriteLine(agency.Name);
            Console.Write("Всего объектов ");
            Console.WriteLine(listObjects.Count);
            for (int i = 0; i < listObjects.Count; i++)
            {
                Console.WriteLine($"{i + 1} - {listObjects[i].Name} ({listObjects[i].Status})");
            }
            Console.ReadKey();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            string        cache;
            List <Agency> aList = new List <Agency>();

            do
            {
                Console.WriteLine("Заменить данные об агентстве? Да или нет");
                cache = Console.ReadLine();
                if (cache.Equals("да"))
                {
                    Agency agency = new Agency("agency");
                }
            } while (!(cache.Equals("да") || cache.Equals("нет")));

            LoadManager loader1 = new LoadManager("agency");

            loader1.BeginRead();
            while (loader1.IsLoading)
            {
                aList.Add(loader1.Read(new Agency.Loader()) as Agency);
            }
            loader1.EndRead();
            bool clearFile = WriteToFile.ClearFile();

            if (clearFile)
            {
                Console.WriteLine("Hear");
                Console.WriteLine(aList[0].Cout);
                for (int i = 0; i < aList[0].Cout; i++)
                {
                    MyObject myObject = new MyObject(aList[0], "myobject");
                }
            }
            LoadManager     loader = new LoadManager("myobject");
            List <MyObject> sList  = new List <MyObject>();

            loader.BeginRead();
            while (loader.IsLoading)
            {
                sList.Add(loader.Read(new MyObject.Loader()) as MyObject);
            }
            loader.EndRead();
            Console.Write("Агенство недвижимости ");
            Console.WriteLine(aList[0].Name);
            foreach (MyObject m in sList)
            {
                Console.WriteLine(m.Name);
            }
            Console.ReadKey();

            Console.ReadKey();
        }