linq question: querying nested collections

前端 未结 4 358
囚心锁ツ
囚心锁ツ 2020-12-04 14:24

I have a Question class that has public List property that can contain several Answers.

I have a question repository which is respo

4条回答
  •  生来不讨喜
    2020-12-04 14:45

    It seems you could use something like this:

    var query = from q in questions
                from a in q.Answers
                where a.Name == "Answer Name"
                select a;
    

提交回复
热议问题