博客园站长
这是人类成长进步中记录的每一时刻

转自:http://bbs.csdn.net/topics/370152213

#2楼

foreach 值是只读的。

所以只能用 for

Dictionary<int, int> d = new Dictionary<int, int>();
    d.Add(1, 1);
    var target = d.ToList();
    for (int index = 0; index < target.Count; index++)
      XX.Write(target[index].Key + " = " + target[index].Value);

posted on 2014-11-07 14:29  dm3344  阅读(174)  评论(0编辑  收藏  举报