.net 中Dictionary的遍历

            Dictionary<int, int> dict = new Dictionary<int, int>();
            dict.Add(200, 1);
            dict.Add(100, 2);
            dict.Add(50, 3);
            dict.Add(20, 4);
            foreach( KeyValuePair<int,int> entry in dict)
            {
                Console.WriteLine(string.Format("key:{0}\nvalues:{1}\n", entry.Key, entry.Value));
            }

文章出处:http://www.diybl.com/course/4_webprogram/asp.net/netjs/20071011/77637.html

posted @ 2009-05-14 11:56  何翔华  阅读(353)  评论(0编辑  收藏  举报