Example #1
0
        static void Main(string[] args)
        {
            Dictionary <int, string> musteriler = new Dictionary <int, string>();

            musteriler.Add(0, "Erkan");
            musteriler.Add(1, "Ali");
            musteriler.Add(2, "Ayşe");
            musteriler.Add(3, "Fatma");

            foreach (var musteri in musteriler)
            {
                Console.WriteLine("ID= " + musteri.Key + "   Ad= " + musteri.Value);
            }

            Console.WriteLine("---------------My Dictionary----------------");
            MyDictionaryDemo <int, string> musteriler2 = new MyDictionaryDemo <int, string>();

            musteriler2.Add(0, "Erkan");
            musteriler2.Add(1, "Ali");
            musteriler2.Add(2, "Ayşe");
            musteriler2.Add(3, "Fatma");

            for (int i = 0; i < musteriler2.Count; i++)
            {
                Console.WriteLine("ID= " + musteriler2.Key[i] + "  Ad= " + musteriler2.Value[i]);
            }


            Console.ReadLine();
        }
Example #2
0
        public static void Main(string[] args)
        {
            MyDictionaryDemo <int, string> cities = new MyDictionaryDemo <int, string>();

            cities.Add(47, "Mardin");
            cities.Add(35, "İzmir");
            cities.Add(06, "Ankara");
            cities.Add(34, "İstanbul");
            cities.Add(61, "Trabzon");



            foreach (var city in cities.Values)
            {
                Console.WriteLine(city);
            }

            foreach (var plates in cities.Key)
            {
                Console.WriteLine(plates);
            }
        }