Skip to content

Instantly share code, notes, and snippets.

@micaelbergeron
Forked from anonymous/gist:7568e6f573e15656ed1d
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micaelbergeron/8caf3eba178c01ed8256 to your computer and use it in GitHub Desktop.
Save micaelbergeron/8caf3eba178c01ed8256 to your computer and use it in GitHub Desktop.
public void saveJoueur(Joueur joueur)
{
List<Joueur> equipe = new List<Joueur>();
List<Joueur> equipeTemp = new List<Joueur>();
equipe = lectureJoueurs();
foreach (Joueur j in equipe)
{
if (joueur.isCapitain && j.isCapitain)
{
// TODO Comment je fait pour mettre un messagebox ici?
Console.WriteLine("Il y a déjà un capitain!");
}
else
{
if (j.numeroJoueur == joueur.numeroJoueur)
equipeTemp.Add(joueur);
else
equipeTemp.Add(j);
}
}
equipe = equipeTemp;
updateJoueurs(equipe);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment