【发布时间】:2013-05-15 15:33:50
【问题描述】:
我有一个对象 Foo 的集合,它的 ICollection 属性包含一个 People 对象列表。
public class Foo
{
public int Id { get; set; }
public string Name { get; set; }
public ICollection<Person> People { get; set; }
}
我还有另一个人员列表。
ICollection<Person> OtherPeople
我需要找到所有对象 Foo,其中 People 包含来自 OtherPeople 的任何人。 是否有接受集合的 .Contains 版本? 比如:
var result = from f in FooCollection
where f.People.Contains(otherPeople)
select f;
如果这很重要,我将它与实体框架一起使用。
【问题讨论】:
标签: linq entity-framework