private static void MaxByAndMinBy()
{
Demo.DisplayHeader("The MaxBy and MinBy operators - the provided selector will determine the maximal/minimal object based on the selected value");
Subject<StudentGrade> grades = new Subject<StudentGrade>();
grades.MaxBy(s => s.Grade)
.SelectMany(max => max)
.SubscribeConsole("Maximal object by grade");
grades.OnNext(new StudentGrade() { Id = "1", Name = "A", Grade = 85.0 });
grades.OnNext(new StudentGrade() { Id = "2", Name = "B", Grade = 90.0 });
grades.OnNext(new StudentGrade() { Id = "3", Name = "C", Grade = 80.0 });
grades.OnCompleted();
}