Quick and probably easy Lambda question:
I have a restaurant with reviews.
I want to query for the one with the:
- Max(AverageRating)
- And the Max(ReviewCount)
- And the Max(NewestReviewDate)
- And the Min(DistanceAway)
Something like this:
var _Result = AllRestaurants
.Max(x => x.AverageRating)
.AndMax(x => x.ReviewCount)
.AndMax(x => x.NewestReviewDate)
.AndMin(x => x.DistanceAway);
Now, I know that is pseudo code. But it describes it perfectly!
Of course, in multiple statements, this is simple.
Just wondering if this is possible in one statement without killing the readability.
Thank you in advance. I know some of you love the query questions!
You can’t have multiple maxes or mins, that doesn’t make sense.
You’ll need some kind of heuristic like: