On Thu, Feb 19, 2009 at 10:21 AM, techBuyer <[email protected]> wrote:
> > Does anyone know the method to locate the highest value in an array or > collection or group of data? Your help is much appreciated. > Locate...ah, you don't want the VALUE, you want the INDEX of the value.... I'd use LINQ.... http://www.google.com/search?q=LINQ+to+get+highest+value Brings me to http://stackoverflow.com/questions/462699/how-do-i-get-the-index-of-the-highest-value-in-an-array-using-linq int maxIndex = -1; int index=0; double maxValue = 0; int urgh = sequence.Select(value => { if (maxIndex == -1 || value > maxValue) { maxIndex = index; maxValue = value; } index++; return maxIndex; }).Last(); That should do it for ya. :).
