LINQ - joining multiple lists

前端 未结 3 409
猫巷女王i
猫巷女王i 2021-01-21 14:33

I\'ve looked at the 101 Linq Samples here but I can\'t see anything like this in that list. If I\'m just not seeing a relevant example there, please link to it.

If I ha

3条回答
  •  青春惊慌失措
    2021-01-21 15:31

    How about:

    IEnumerable FindCoursesForStudent(Student student)
    {
        return from enrolment in Enrolments 
               where enrolment.studentId == student.id
               join course in Courses
                  on enrolment.courseId equals course.id
               select course;
    }
    

提交回复
热议问题