首页 新闻 会员 周边

Dictionary分组问题求助

0
悬赏园豆:30 [已解决问题] 解决于 2016-09-04 14:42

如何将如下代码段中的dic.Key.Value的值为0-8的全部用Lambda表达式提取到另一个字典集合中

Dictionary<KeyValuePair<int, int>, string> dic = new Dictionary<KeyValuePair<int, int>, string>();
            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    dic.Add(new KeyValuePair<int, int>(i, j), i + "aaa" + j);
                }
            }
梦天涯的主页 梦天涯 | 初学一级 | 园豆:103
提问于:2016-09-03 22:20
< >
分享
最佳答案
0

dic.Where(t => t.Key.Value >= 0 && t.Key.Value <= 8).ToDictionary(t => t.Key, t => t.Value)

收获园豆:30
jello chen | 大侠五级 |园豆:7306 | 2016-09-04 00:20

非常感谢

梦天涯 | 园豆:103 (初学一级) | 2016-09-04 14:41
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册