慢慢积累吧。
为了给公司升级服务器,等到现在。
IT不容易呀。
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 using System.Collections; 7 8 namespace ConsoleApplication3 9 { 10 class Program 11 { 12 static void Main(string[] args) 13 { 14 int[] arr = new int[] { 1, 2, 3, 4, 5, 6 }; 15 ArrayList List = new ArrayList(arr); 16 Console.WriteLine("Original collections: "); 17 foreach (int i in List) 18 { 19 Console.Write(i + " "); 20 } 21 Console.WriteLine(); 22 for (int i = 1; i < 5; i++) 23 { 24 List.Add(i + arr.Length); 25 } 26 Console.WriteLine(" use add method add : "); 27 foreach (int i in List) 28 { 29 Console.Write(i + " "); 30 } 31 Console.WriteLine(); 32 List.Insert(6, 6); 33 Console.WriteLine("use insert method add: "); 34 foreach (int i in List) 35 { 36 Console.Write(i + " "); 37 } 38 Console.WriteLine(); 39 Console.WriteLine(); 40 Console.WriteLine(); 41 Hashtable hashtable = new Hashtable(); 42 hashtable.Add("id ", "BH0001"); 43 hashtable.Add("name ", "TM"); 44 hashtable.Add("sex ", "Male"); 45 hashtable.Add("age ", "25"); 46 hashtable.Add("nation ", "China"); 47 Console.WriteLine("\tkey\tvalue"); 48 foreach (DictionaryEntry dicEntry in hashtable) 49 { 50 Console.WriteLine("\t" + dicEntry.Key + "\t" + dicEntry.Value); 51 } 52 53 Console.ReadKey(); 54 } 55 } 56 }
时间: 2024-10-28 21:06:59