Helloo! I have some problems with hashset. I dont want use list because i dont want duplicated values.

Code:
for (int i = 0; i < Globals.Globals.PlayersList.Count; i++)
{
    var ent = Globals.Globals.PlayersList[i];
    if (ent.name != null && !ent.PlayerConnected && !ent.PlayerDisconnected)
    {
        ent.PlayerConnected = true;
        //Adding player in game, not showing my code :3
    }
}
If i use foreach then i get errors because list changed...