示例#1
0
        static void Main(string[] args)
        {
            //Dictionary<int, string> myList = new Dictionary<int, string>();

            Person person1 = new Person
            {
                Id   = 1,
                Name = "Melike Özbey"
            };

            Person person2 = new Person
            {
                Id   = 2,
                Name = "Ayşe Yılmaz"
            };

            //myList.Add(person.Id, person.Name);

            MyDictionary <int, string> myDictionaryList = new MyDictionary <int, string>();

            myDictionaryList.Add(person1.Id, person1.Name);
            myDictionaryList.Add(person2.Id, person2.Name);

            Console.WriteLine(myDictionaryList.Count);
            myDictionaryList.List();
        }
示例#2
0
        private static void MyDictionary()
        {
            MyDictionary <string, string> sozluk = new MyDictionary <string, string>();

            sozluk.Add("klavye", "keyboard");
            sozluk.Add("fare", "mause");

            Console.WriteLine(sozluk.Count);
            Console.WriteLine(sozluk.Keys);
            Console.WriteLine(sozluk.Values);
            sozluk.List();
        }