I have an object allStudents = Dictionary<ClassRoom, List<Student>>()
In Linq how would I get a list of all the students who are male? (student.Gender==”m”) from all the Classrooms?
Ian
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try the following
The trick to this is the
SelectManyoperation. It has the effect of flattening a collection ofList<Student>into a single collection ofStudent. The resulting list is the same as if you’d lined up each list front to back.