I have a Game class holding a list of players.
class Game {
Player[] Players;
}
I have two hub methods:
OnDisconnected() {
room.Players.Remove(3);
}
CalculateScore() {
int score = room.Players[3].Score;
// use score
}
OnDisconnected
is removing a player, CalculateScore
is using that player to calculate score.
What happens when user disconnects while CalculateScore
is running.
How do I handle this situation?