.net 中Dictionary的遍历

.net 中Dictionary的遍历

            Dictionary<intint> dict = new Dictionary<intint>();
            dict.Add(
2001);
            dict.Add(
1002);
            dict.Add(
503);
            dict.Add(
204);
            
foreach( KeyValuePair<int,int> entry in dict)
            {
                Console.WriteLine(
                    
string.Format("key:{0}\nvalues:{1}\n",
                                  entry.Key,
                                  entry.Value
                                 )
                );
            }
posted @ 2010-03-03 17:34  遥望星空  阅读(947)  评论(0编辑  收藏  举报