Answer the question
In order to leave comments, you need to log in
How to delete a player's result if he "departed" from the rating?
I need to make sure that the player is removed from the dictionary and from the file, if he "flies" out of the rating (i.e. takes 6th place)
here is the code for sorting them in places, maybe it will help with something:
private void updateRatingLabels() {
var tops = AllNames()
.OrderBy(pair => pair.Value)
.ThenBy(pair => pair.Key, StringComparer.Ordinal)
.Take(5)
.ToArray();
for (int i = 18; i <= 22; ++i)
Controls.Find($"label{i}", true).First().Text = "";
for (int i = 28; i <= 32; ++i)
Controls.Find($"label{i}", true).First().Text = "";
for (int i = 0; i < tops.Length; ++i) {
Controls.Find($"label{i + 18}", true).First().Text = tops[i].Key;
Controls.Find($"label{i + 28}", true).First().Text = tops[i].Value.ToString();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question