Find highest integer in a Generic List using C#?
.net-3.5, c#
Solution
You can just do:
int max = MyList.Max();
See Enumerable.Max for details.
Problem
I have the following `List<int>` collection and I need to find the highest integer in the collection. It could have an arbitrary number of integers and I can have same integer value for multiple times. ``` List<int> MyList = new List<int> { 3, 4, 6, 7, 9, 3, 4, 5, 5 }; ``` What is the simplest algorithm to use for finding the highest integer? I am using C# and the .NET 3.5 framework.