【发布时间】:2015-06-09 16:00:39
【问题描述】:
为什么当我尝试查询IList 类型对象时,下面的代码什么也不返回?
IList<Person> personRecord = new List<Person>
{
new Person{ Name = "Samuel"},
new Person{ Name = "Kenny Sammy"},
new Person{ Name = "Jame Sam Lee"}
};
var names = from b in personRecord
where personRecord.Any(d => d.Name == "Sam")
select b;
return names.ToList();
【问题讨论】:
-
可能是因为没有
Person的Name属性等于“Sam”