Using the following simple Item class:
class Item
{
public int Value { get; set; }
}
And this list of items:
var items = new List<Item>();
items.Add( new Item() { Value = 1 } );
items.Add( new Item() { Value = 2 } );
items.Add( new Item() { Value = 3 } );
How to tell the greatest value in all items?
How to determine which Item in the list has the greatest value?
Using LINQ
Items containing greatest value
However, MaxBy extension method suggested by devdigital will iterate the collection only once