Say I have a list of cars:
List<string> carList = new List<string>(){"Car1", "Car2", "Car3"};
I then have prices assigned to each car in another list where the first item corresponds to Car1 etc:
List<int> priceList = new List<int>(){50, 200, 10};
Now I want to sort my carList based on the highest price in priceList, with the expected outcome of my carList now having the order like this:
"Car2", "Car1", "Car3"
This needs to be done as fast as possible, it is the only thing that matters. It doesn't matter if carList is sorted itself or if I need to create a new list to store the sorted values in. I don't have any use of priceList after this sorting is completed and don't need its values.
Car-class with properties like"Name"and"Price"? Then it's pretty easy to have a list of those instances and sort that.