C
C#2y ago
Wasabi2320

Trying to sort top 3 highscores, need help

I've made a list of highscores, but I'd like to sort out the top 3 ones. I've been looking at some tutorials but im still lost. I'd like some help
10 Replies
Cracker
Cracker2y ago
allowed to use LINQ ?
Wasabi2320
Wasabi2320OP2y ago
yeah Im allowed to use Linq
Connor
Connor2y ago
Order them by the score and then skip 3
Wasabi2320
Wasabi2320OP2y ago
How would I do that?
Sherbert Lemon
highscore.OrderBy(score => score.Points_) and then you just want the first 3 items?
Wasabi2320
Wasabi2320OP2y ago
I want top 3 highscores so if someone had scores 1, 5, 6, 4, 3 it would be 6, 5, 4
Sherbert Lemon
okay well you would first use linq as the person above said
Sherbert Lemon
then get it by descending, and get the values out, either through a loop or slicing the list
Wasabi2320
Wasabi2320OP2y ago
also a weird thing is that my highscore file doesnt access my text file "highscore.txt" eventhough it should
Want results from more Discord servers?
Add your server