Select max age C#
c#, list, max
Solution
Max is used to find the maximum value of a property. Once you have the maximum value you can select those objects whose value matches using the Where clause.
var maxZ = list.Max( obj => obj.Z );
var maxObj = list.Where( obj => obj.Z == maxZ );
Problem
I created a `list<T>` that contains a collection of objects that have this properties: `X`, `Y`, `Z` I want to find out which object in the collection has the greatest `Z` I tried to use the `Max()` function but I don't understand how it's used...