I am creating a high score top5 list and i have no clue how to sort the data from the text file and write out the top5 with the highest int. Right now i have a program that writes the results to the text file highscore.txt.
I want it to look something like this.
Highscore
1. 500pts
2. 450pts
3. 400pts
4. 350pts
5. 300pts
I would suggest to use a real database instead, for example the free Sql-Server Express.
If you really want to use a text-file, you could use this approach:
Now you can for example use a
foreachto output the strings.Note that you need to add
using System.Linq;.