开发者

Linq - How to turn IQueryable<IEnumerable> into IQueryable

I have a simple linq statement that isn't quite returning what I would like. I understand why, I just don't know how to wriet it to get what I want. The query is as follows:

answers = from a in ents.tblCalls
                          where a.tblSessions.tblUsers.UserID == UserID.Value
                          && (a.StartTime >= startdate.Value && a.StartTime <= enddate.Value)
                          select a.tblAnswers.Where(p => p.tblAnswerTypes.AnswerType ==
                              "Yes" && p.tblQuestions.tblQuestionTypes.QuestionType == "Sell In");

This is giving me a return type of IQueryable<开发者_如何学C; IEnumerable < tblAnswers >>, whereas all I really want is the IQueryable < tblAnswers > so that I can work with them later easily.

Thanks guys!


public IQueryable<tblAnswers> ConcatenateResult
       (IQueryable<IEnumerable<tblAnswers>> answers) 

    newAnswers = List<tblAnswers>();
    for (i = 0, i < answers.Count() , i++)
    {
        newAnswers.AddRange(answers[i])
    }

    return newAnswers.AsQueryable()
}

Kindness,

Dan

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜