转换字典值使用LINQ列出 [英] Convert dictionary values to list using linq

查看:297
本文介绍了转换字典值使用LINQ列出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的代码给我'lambda表达式的评价是不是在调试器的有效。
请建议我在哪里从下面做错了 -

Following code giving me 'Evaluation of lambda expressions is not valid in the debugger'. Please suggest where I am doing wrong from below -

List<MyFieldClass> lstFiedls;
lstFiedls = objDictionary.Select(item => item.Value).ToList();



谢谢,

Thanks,

推荐答案

您不需要使用LINQ获取值。在词典(TKEY的,TValue)具有保存价值的属性,的 词典(TKEY的,TValue).Values​​

You don't need to use Linq to get the values. The Dictionary(TKey, TValue) has a property that holds the values, Dictionary(TKey, TValue).Values:

var fields = objDictionary.Values.ToList();

这篇关于转换字典值使用LINQ列出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆