C# find highest array value and index

This is not the most glamorous way but works.

(must have using System.Linq;)

 int maxValue = anArray.Max();
 int maxIndex = anArray.ToList().IndexOf(maxValue);

Leave a Comment