I've created this program that will assemble a leaderboard array that will store scores from a game with the usernames beside the score. This leaderboard is constantly being updated everytime the game is played. These scores are appended into a text file, and the contents of the text file is entered into the leaderboard array. I want to sort this array so that the scores are descending, of course with the player name beside the corresponding score. The array looks something like this:
|User1, 9.0, 2, 0|User2, 8.0, 0, 1|User3, 8.5, 0, 1
So the format for this array goes like this:
|Username1, totalscore, wins, losses | Username2 , totalscore, wins, losses ect...
How would I sort this array so that the user with the highest score will appear first in the array and display it? I've heard that merge sort is easiest, but is this true? I appreciate any help!
User1, 9.0, 2, 0, second elementUser2, 8.0, 0, 1and so forth? or is it a single string containing|User1, 9.0, 2, 0|User2, 8.0, 0, 1|User3, 8.5, 0, 1?fieldlist.OrderBy(Function(x) x.totalscore).ToList()or create a separate function call. Or the list.sort method. See here: stackoverflow.com/questions/1832684/… Some interesting stuff in some of the answers there that could be relevant to you.