List<T>.SelectMany(), Linq and lambda help
        Posted  
        
            by jim
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by jim
        
        
        
        Published on 2010-05-19T09:13:51Z
        Indexed on 
            2010/05/19
            9:20 UTC
        
        
        Read the original article
        Hit count: 694
        
Hi there
I have a class.
public class MedicalRequest
{
    private int id
    private IList<MedicalDays> Days 
    private string MedicalUser
    ...
}
and another
public class MedicalDays
{
    private int id;
    private DateTime? day
    private MedicalRequest request
    ...
}
I'm using nhibernate to return a list of all the MedicalDays within a time span. I'd like to do something like this to 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 inferred by the usage. I'd like to know what I'm doing wrong, and if there is a preferred way of doing something like this.
Thanks for your time.
© Stack Overflow or respective owner