1            //数组
 2            //Time[] times = new Time[2] { new Time(21, 7, 10), new Time(9, 10, 11) };
 3            //Time[] copyToTimes = new Time[times.Length];
 4            //times.CopyTo(copyToTimes, 0);
 5            //foreach (Time time in copyToTimes)
 6            //{
 7            //    Console.WriteLine(time.ToString());
 8            //}
 9
10            //ArrayList数组
11            ArrayList times = new ArrayList();
12            times.Add(new Time(21710));
13            times.Add(new Time(91011));
14
15            Time[] copyToTimes = new Time[times.Count];
16            times.CopyTo(copyToTimes, 0);
17
18            foreach (Time time in copyToTimes)
19            {
20                Console.WriteLine(time.ToString());
21            }

22
23            //队列
24            //Queue<int> queue = new Queue<int>();
25            //foreach (int i in new int[] { 8, 10, 2, 3, 6, 5 })
26            //{
27            //    queue.Enqueue(i);
28            //}
29            //while(queue.Count>0)
30            //{
31            //    Console.WriteLine(queue.Dequeue());
32            //}
33
34            //堆栈
35            //Stack<int> stack = new Stack<int>();
36            //foreach (int i in new int[] { 8, 10, 2, 3, 6, 5 })
37            //{
38            //    stack.Push(i);
39            //}
40            //while (stack.Count > 0)
41            //{
42            //    Console.WriteLine(stack.Pop());
43            //}
44
45            //Hashtable 不允许有重复KEY的元素
46            //Hashtable ages = new Hashtable();
47            //ages["don"] = 27;
48            //ages["fly"] = 27;
49            //ages["don"] = 29;//不会抛异常,但会将此key的value覆盖
50            //ages.Add("don", 29);//会抛异常
51            //foreach (DictionaryEntry e in ages)
52            //{
53            //    string name = e.Key.ToString();
54            //    int age = (int)e.Value;
55            //    Console.WriteLine("Name:{0},Age:{1}", name, age);
56            //}
57
58            //SortedList 元素已自动排序
59            //SortedList ages = new SortedList();
60            //ages["sun"] = 28;
61            //ages["fly"] = 27;
62            //ages["don"] = 27;
63            //foreach (DictionaryEntry e in ages)
64            //{
65            //    string name = e.Key.ToString();
66            //    int age = (int)e.Value;
67            //    Console.WriteLine("Name:{0},Age:{1}", name, age);
68            //}