Hi,

I have a collection of integers, and I want to pick out the index of the smallest element. E.g. for a collection (3,13,7,2), the output must be “4”.

Is there an easy way to pick out the largest or smallest element of an array or collection?

Hi,

I have a collection of integers, and I want to pick out the index of the smallest element. E.g. for a collection (3,13,7,2), the output must be “4”.

Is there an easy way to pick out the largest or smallest element of an array or collection?

Hi,

Array.FindIndex(intArray,Function(i) i = intArray.Min)

intArray being your array of inger would do.

Note however than in .Net, index are 0 based (or starting at 0 so it will be 3)

You will have to inscrement it by one.

Cheers

3 Likes

This solved the problem. Thanks, and sorry for the late response.