예제 #1
0
        static void Main(string[] args)
        {
            int          j = 0;
            string       a, b;
            int          g;
            MyDictionary C3 = new MyDictionary(6);

            string[] City1 = new string[4] {
                "Perm", "Moscow", "Kaliningrad", "Vladivostok"
            };
            string[] City2 = new string[2] {
                "Kiev", "Lugansk"
            };
            string[] City3 = new string[1] {
                "Tokyo"
            };
            string[] City4 = new string[3] {
                "London", "Oxford", "Kambridge"
            };
            string[] City5 = new string[2] {
                "Pattya", "Bankok"
            };

            List <State> Country = new List <State>();

            a = "Russia"; State             h3 = new State(a, City1); Country.Add(h3);
            a = "Ukraine"; g = 55; Republic h1 = new Republic(a, City2, g); Country.Add(h1);
            a = "Japan"; g = 66; Monarchy   h2 = new Monarchy(a, City3, g); Country.Add(h2);
            a = "United Kingdom"; g = 33; b = "Elizabeth II"; Kingdom h4 = new Kingdom(a, City4, b, g); Country.Add(h4);

            List <State> Country2 = new List <State>();

            Country2.Add(h3);
            Country2.Add(h4);


            Console.WriteLine("Запрос на выборку данных (все города России):");
            Console.WriteLine("");

            GetData1(Country, "Russia");
            Console.WriteLine("");
            GetData2(Country, "Russia");

            Console.WriteLine("");
            Console.WriteLine("Запрос на получение счетчика (число королевств)");
            Console.WriteLine("");

            Count1(Country);
            Console.WriteLine("");
            Count2(Country);

            Console.WriteLine("");
            Console.WriteLine("Запрос на пересечение множеств");
            Console.WriteLine("");

            Intersection1(Country, Country2);
            Console.WriteLine("");
            Intersection2(Country, Country2);

            Console.WriteLine("");
            Console.WriteLine("Запрос на агрегирование данных (страны с наибольшим и наименьшим числом городов):");
            Console.WriteLine("");

            Aggregate1(Country);
            Console.WriteLine("");
            Aggregate2(Country);
        }
 public MyDictionary(MyDictionary c)
 {
     this.capacity = c.capacity;
     this.Country3 = c.Country3;
 }