C# Linq查询的问题 我有个字典对象mydictionary_address 里面的类型存放的是<string,string> 举列里面的数据是{abc,7,8,9},{cdb,10,}。。。。。。。等等,现在我想提高效率用linq查询出var LinqValue = from dic in mydictionary_address where (dic.Value.Split(',').Length )> 1 select dic.Value;,意思是查询value大于一个以上的dic,可是每次执行发现取出的都是之前原本全部的数据,并没有过滤掉得到我想要的几个数据,这是为什么?还怎么解决?
------解决方案--------------------
var r = from add in addressDic where add.Value.Split(',').Length > 1 select add.Value;
------解决方案-------------------- Dictionary<string, string> addressDic = new Dictionary<string, string>(); addressDic.Add("A1", "a,b,c,d,e"); addressDic.Add("A2", "1,2,3"); addressDic.Add("A3", "4,5,6"); addressDic.Add("A4", "1");
var r = from add in addressDic where add.Value.Split(',').Length > 1 select add.Value;