[转载]C#中字典集合的两种遍历

Dictionary<string, string> dictionary = new Dictionary<string,string>();



foreach (string dic in dictionary.Keys)
{
    //Key: dic
    //Value: dictionary[dic]
}
foreach (KeyValuePair<string, string> dic in dictionary
{
    //Key: dic.Key
    //Value: dic.Value 
}

http://blog.csdn.net/mhtshhp/article/details/5208665

posted on 2014-06-05 10:19  iackjee  阅读(770)  评论(0编辑  收藏  举报

导航