List <T> .SelectMany (), Linq and lambda

I have a class.

public class MedicalRequest
{
    private int id
    private IList<MedicalDays> Days 
    private string MedicalUser
    ...
}

      

and further

public class MedicalDays
{
    private int id;
    private DateTime? day
    private MedicalRequest request
    ...
}

      

I am using nhibernate to return a list of all MedicalDays over a period of time. I would like to do something like this in the resulting list

//nhibernate query
IList<MedicalDays> days = daysDao.FindAll(searchCritCollection);

//select a list of days from resulting list
IEnumerable<MedicalDays> queriedList = 
        days.SelectMany(i => i.MedicalRequest.MedicalUser == employee);

      

Linq tells me that the type cannot be deduced from use. I would like to know what I am doing wrong and if there is a preferred way to do something like this.

Thank you for your time.

+2


a source to share


1 answer


It looks to me like you want to filter the list days

. If you want you should use



days.Where(i => i.MedicalRequest.MedicalUser == employee);

      

+10


a source







All Articles