How to perform .Max() on a property of all objects in a collection and return the object with maximum value
Asked 07 September, 2021
Viewed 1.5K times
  • 62
Votes
public class DimensionPair  
{
    public int Height { get; set; }
    public int Width { get; set; }
}

I want to find and return the object in the list which has the largest Height property value.

I can manage to get the highest value of the Height value but not the object itself.

Can I do this with Linq? How?

9 Answer