How do I sort lists from a text file
Just curious how to take lines from a text file into a list then sort the list in terms of highest score, each line would be their own object and id like to output the highest amount of saves/score
5 Replies
thanks in advance
i tried doing something by looking up the syntax however in the first foreach i get a cant convert char to string error
despite declaring path as a string
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Kazaam nailed it, you're not actually reading from a file. Check out the
File.ReadAllLines
method for more details on how to do that easily.
Then, I'd suggest using lines.Select(x => ...)
to turn each line of text (a string) into an object with what I guess is a score and a name. After that you can order the list before finalizing it with .ToList()