Hello:
Having a bit of a problem getting my LINQ query to return the object type I want to work with. I'm pretty close just need a little bit of input.
I have five tables, Objects, People, Locations, Collections, and CollectionEntries.
Object is the base class for People, Locations, and Collections. A Collection has many CollectionEntries which may contain entries to People, Locations, and Collections.
Given a specific collection I want to write the LINQ query to retreive the People in that collection.
So far I have this, which returns me a list of CollectionEntries ( they correspond to the People entries, yay half way! ) but I would rather have it return the instances of the People.
var people = collection.CollectionEntries.Where(
entry => entry.Object is Person ).ToList();
I have tried doing this:
var people = collection.CollectionEntries.Where(
entry => entry.Object is Person ).OfType<Person>().ToList();
but it doesn't return anything. Any suggestions of how to get a list of People from my Collection?