static public void Show()
        {
            ExDeviderV2.AdditionalEx();

            ArrayList myAL = new ArrayList();

            myAL.Add("string");
            myAL.Add(12);

            Console.WriteLine("foreach  in ArrayList: ");
            foreach (var el in myAL)
            {
                Console.WriteLine(el);
            }

            ExDeviderV2.Line();

            Console.WriteLine(" for  in ArrayList: ");
            for (int i = 0; i < myAL.Count; i++)
            {
                Console.WriteLine(myAL[i]);
            }


            ExDeviderV2.Line();
        }
        public static void Show()
        {
            ExDeviderV2.Ex2();

            Console.WriteLine("CArCollection:");
            var park = new CarCollection <string>();

            park.AddCar("Жигули", new DateTime(1985, 12, 5));
            park.AddCar("Тойота", new DateTime(2000, 4, 7));
            park.AddCar("Форд", new DateTime(2005, 5, 3));
            park.AddCar("Мерседес", new DateTime(2003, 11, 3));

            Console.WriteLine(park.ToString());

            park.CarCount();

            Console.WriteLine("Enter the index of car:");
            string stroka = Console.ReadLine();

            if (string.IsNullOrEmpty(stroka))
            {
                Console.WriteLine("Nothing was entered! ");
            }
            else
            {
                int nomer = Convert.ToInt32(stroka);
                Console.WriteLine(park[nomer - 1]);
            }


            ExDeviderV2.Line();
        }
Esempio n. 3
0
        static public void Show()
        {
            ExDeviderV2.Ex3();

            var dictionary = new MyDictionary <string, string>();


            dictionary.Add("table", "стол");
            dictionary.Add("apple", "яблоко");
            dictionary.Add("sun", "солнце");
            dictionary.Add("pencil", "карандаш");
            dictionary.Add("cap", "чашка");
            dictionary.Add("tea", "чай");


            dictionary.ShowDict();
            ExDeviderV2.Line();
            Console.WriteLine("Введите номер записи в словаре:");
            string str = Console.ReadLine();

            ExDeviderV2.Line();
            if (string.IsNullOrEmpty(str))
            {
                Console.WriteLine("Вы не ввели номер записив словаре");
            }
            else
            {
                int nomer = Convert.ToInt32(str);
                Console.WriteLine(dictionary[nomer - 1]);
            }
            ExDeviderV2.Line();
            Console.WriteLine("Введите значение для поиска");
            string p = Console.ReadLine();

            Console.WriteLine(dictionary.Contains(p));

            ExDeviderV2.Line();
            Console.WriteLine("Введите значение для поиска");
            p = Console.ReadLine();
            Console.WriteLine(dictionary.Contains(p));

            ExDeviderV2.Line();
        }