Код: Выделить всё
public class Student
{
public string Name { get; set; }
public int Grade { get; set; }
}
Результат должен выглядеть так:
Код: Выделить всё
John 100
John 80
Lucy 80
Lucy 50
Lucy 40
Eric 70
Eric 30
Код: Выделить всё
StudentsGrades.GroupBy(student => student.Name)
.OrderBy(studentGradesGroup => studentGradesGroup.Max(student => student.Grade));
Есть ли более красивый способ сделать это?
Подробнее здесь: https://stackoverflow.com/questions/501 ... each-group