1. Hashtable Implement Hashtable Table=NewHashtable (); while(true) {Console.WriteLine ("------------------1. Increase--------------------"); Console.WriteLine ("------------------2. Query--------------------"); Console.WriteLine ("------------------3. Check all----------------"); Console.WriteLine ("------------------4. Delete--------------------"); Console.WriteLine ("Please enter the features you want to use:"); intnum =int. Parse (Console.ReadLine ()); Switch(num) { Case 1: Console.WriteLine ("Please enter your name:"); stringName =Console.ReadLine (); Console.WriteLine ("Please enter the age gender Hobby contact Method:"); stringstr =Console.ReadLine (); Table. ADD (name, str); Break; Case 2: Console.WriteLine ("Please enter your name:"); stringNamequery =Console.ReadLine (); Console.WriteLine (); if(table. Contains (Namequery)) {Console.WriteLine (Namequery+" "+Table[namequery]); } Break; Case 3: Console.WriteLine (); foreach(DictionaryEntry Dinchtable) {Console.WriteLine (D.key+" "+d.value); } Break; Case 4: Console.WriteLine ("Please enter your name:"); stringDelete =Console.ReadLine (); Table. Remove (delete); Break; }2:list<keyvaluepair>Generic Implementation List<KeyValuePair<string,string>> Listkey =Newlist<keyvaluepair<string,string>>(); while(true) {Console.WriteLine ("------------------1. Increase--------------------"); Console.WriteLine ("------------------2. Query--------------------"); Console.WriteLine ("------------------3. Check all----------------"); Console.WriteLine ("------------------4. Delete--------------------"); Console.WriteLine ("Please enter the features you want to use:"); intnum =int. Parse (Console.ReadLine ()); Switch(num) { Case 1: Console.WriteLine ("Please enter the name you added:"); stringName =Console.ReadLine (); Console.WriteLine ("Please enter the age gender Hobby contact Method:"); stringstr =Console.ReadLine (); Listkey. ADD (Newkeyvaluepair<string,string>(name, str)); Console.WriteLine ("Success"); Break; Case 2: Console.WriteLine ("Please enter the name of the search:"); stringNamequery =Console.ReadLine (); Console.WriteLine (); if(Listkey) {Console.WriteLine (Namequery+" "+Listkey[namequery]); } Console.WriteLine ("Success"); Break; Case 3: Console.WriteLine ("Find All"); foreach(DictionaryEntry DinchListkey) {Console.WriteLine (D.key+" "+d.value); } Console.WriteLine ("Success"); Break; Case 4: Console.WriteLine ("Please enter the name of the deletion:"); stringDelete =Console.ReadLine (); Table. Remove (delete); Console.WriteLine ("Success"); Break; }
C # Foundation fourth day-job answer-hashtable-list<keyvaluepair> generic implementation business card