Note: pseduo code and fake classes / properties branded-in-place ... to protect the innocent
I am trying to get an instance Personwhere a person has a specific name ... as a result IQueryable.
Given the following code ...
public class Person
{
public ICollection<PersonDetails> PersonDetails { get; set; }
}
public class PersonDetails
{
public string Name { get; set; }
}
how can i get Personwho has the name "fred"?
I tried (which failed) ....
public static IQueryable<Person> WithName(this IQueryable<Person> value,
string name)
{
return value.Where(x => x.PersonDetails.Where(y => y.Name == name));
}
.. and this does not compile.
Any clues, peeps?
source
share