var marks from mark in marksList join student in studentsList on mark

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
var marks =
from mark in marksList
join student in studentsList
on mark.StudentID equals student.ID
where (student.LastName == lastName) && (student.FirstName == firstName) && (student.SecondName == secondName)
orderby mark.SessionNumber ascending,
mark.Subject ascending,
mark.Status ascending
select mark;
foreach (var mark in marks) {
// здесь типа выводишь оценку, без вложенного foreach
Console.WriteLine ();
}