How to find the highest variable in an array - C#

I have a array of variables that updates. I need to find the highest variable in the array. It is a float variable. Eric5h5’s answer does not work because it is in JS and Mathf.Max() only gives the highest value. I need the highest variable and its name not only the value.

Thank you all in advance

You can define a variable to store the highestValue with the lowest value you might find in the array and check it with each variable in the array, like:

float highestValue = -10f;
for(int i = 0; int < array.length; i++)
    if(array[index] > highestValue)
        highestValue = array[index];

I don’t know how you defined the array so you might have to change the way to store the highest value.