Arrange list of floats "Ascending Descending"

Hi guys,

I am currently creating a simple horse racing game just for learning purposes more than anything.

I have been toying around with how to record my race results, I have 6 horses that each have timers attached that starts and ends with a trigger.

Now what i am left with is the following:
21.064, 22.456, 30.846, 15.545 etc…

How can i sort these floats out so that i can display them in my results page? I can record the fastest and slowest times by comparing the times as they finish and then saving to playerprefs but for positions 2,3,4,5 i am struggling to find a way so i thought since i already have the times recorded why not just arrange them after the race into a list.

Please answer in C# as that is what i code in

Anyhelp would be great.

store them in a List and then you can do something like:


yes, it’s really that simple :wink:

if you want to sort in a different order, you’ll need to modify things a little but check out the interwebs for examples of how to do it.