遍历并修改dictionary的值

System.Collections.Generic.Dictionary<test ,string > dic=new Dictionary<test,string> ();
            test djj = new test();
            dic.Add(djj,"wyl");
            List<test> list = new List<test>();
            list.AddRange(dic.Keys);
            list[0].name = "djj2";
            foreach (test t in list)
            {
                dic[t] = "wyl2";
            }
            Console.WriteLine(dic[list[0]]);

posted @ 2014-12-01 23:08  marslin_1984  阅读(141)  评论(0编辑  收藏  举报