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
精彩评论