转自: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);