var result = studentList
.Join(markList, m => m.Id, s => s.Sid, (s, m) => new { s, m })
.GroupBy(t => t.s)
.Select(g => new
{
Student = g.Key,
MarksCount = g.Count(),
Marks = g.Select(x => x.m).ToList()
})
.ToList();
MarksCount – total marks for this student
Marks – List of marks for this student
solved Linq join between two Lists [closed]