I'm currently making a simple game using c# in visual studios for college, atm I have been saving the player name and score to a text file, what I'm looking to to do is sort that text file by highest score and save it again
I've got a basic array to display the outcome in a list box and sorts by name but I want to sort it by the score, if anyone could steer me.in the right direction that be appreciated
private void scoreArray()
{
string[] fileName = File.ReadAllLines(@"E:\College Year 3\Computer Programming 2\Minefield\Leaderboard.txt");
Array.Sort(fileName);
foreach (string score in fileName)
{
listBox1.Items.Add(score);
}
}
The data in the text file is stored as Name score