遍历并修改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 @   sweetjian  阅读(7725)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示