Skip to content

Instantly share code, notes, and snippets.

@poemdexter
Created July 12, 2011 03:42
Show Gist options
  • Save poemdexter/1077352 to your computer and use it in GitHub Desktop.
Save poemdexter/1077352 to your computer and use it in GitHub Desktop.
copying playerlist for thread safe enumeration
public List<Player> getPlayerListCopy()
{
List<Player> copy;
lock (this.playerList)
{
copy = this.playerList.ToList();
}
return copy;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment