you can sort the array by using Array.Sort and get the first value from the array if the sort id ascending else last value in case of descending.

I dont have idea about using the array sort function , never used it. May be should should consult the documentation