私は、オブジェクトFooのコレクションにPeopleオブジェクトのリストを含むICollectionプロパティを持っています。コレクションのプロパティに別のリスト内のアイテムが含まれているすべてのアイテムを検索
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のPersonが含まれています。 コレクションを受け入れる.Containsのバージョンがありますか? 何かのように:それは重要な場合
var result = from f in FooCollection
where f.People.Contains(otherPeople)
select f;
私は、Entity Frameworkを使用して、これを使用しています。