People オブジェクトのリストを含む ICollection プロパティを持つオブジェクト Foo のコレクションがあります。
public class Foo
{
public int Id { get; set; }
public string Name { get; set; }
public ICollection<Person> People { get; set; }
}
Person の別のリストがあります。
ICollection<Person> OtherPeople
People に OtherPeople の Person が含まれているすべてのオブジェクト Foo を見つける必要があります。コレクションを受け入れる .Contains のバージョンはありますか? 何かのようなもの:
var result = from f in FooCollection
where f.People.Contains(otherPeople)
select f;
それが重要な場合、私はこれをEntity Frameworkで使用しています。