Exemplo n.º 1
0
        /// <summary>
        /// Стартовая точка программы
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            var spisokFirst = new PersonList();

            spisokFirst.AutoFill(3);

            var spisokSecond = new PersonList();

            spisokSecond.AutoFill(3);

            PersonListConsoleView(spisokFirst, nameof(spisokFirst));
            PersonListConsoleView(spisokSecond, nameof(spisokSecond));
            Console.ReadKey();
            Console.Clear();

            Console.WriteLine("Добавление нового человека в список.");
            spisokFirst.AddPerson(Person.GetRandomPerson());

            PersonListConsoleView(spisokFirst, nameof(spisokFirst));
            PersonListConsoleView(spisokSecond, nameof(spisokSecond));
            Console.ReadKey();
            Console.Clear();

            Console.WriteLine("Копирование второго человека из" +
                              " первого списка во второй список.");
            spisokSecond.AddPerson(spisokFirst.GetPersonByIndex(1));

            PersonListConsoleView(spisokFirst, nameof(spisokFirst));
            PersonListConsoleView(spisokSecond, nameof(spisokSecond));
            Console.ReadKey();
            Console.Clear();

            Console.WriteLine("Удаление второго человека" +
                              "из первого списка.");
            spisokFirst.DeleteByIndex(1);

            PersonListConsoleView(spisokFirst, nameof(spisokFirst));
            PersonListConsoleView(spisokSecond, nameof(spisokSecond));
            Console.ReadKey();
            Console.Clear();

            Console.WriteLine("Отчистка второго списка.");
            spisokSecond.Clean();

            PersonListConsoleView(spisokFirst, nameof(spisokFirst));
            PersonListConsoleView(spisokSecond, nameof(spisokSecond));
            Console.ReadKey();
            Console.Clear();

            var chelovek = EnterPersonKeyboard();

            PersonConsoleView(chelovek);
            Console.ReadKey();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Стартовая точка программы
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            var personList = new PersonList();

            personList.AutoFill(7);
            PersonListConsoleView(personList, nameof(personList));
            Console.ReadKey();
            Console.Clear();

            var person = personList.GetPersonByIndex(3);

            if (person is Child)
            {
                Console.WriteLine((person as Child).ParentTwoInfo);
            }

            if (person is Adult)
            {
                Console.WriteLine((person as Adult).PlaceOfWork);
            }

            Console.ReadKey();
            Console.Clear();
        }