Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/7568e6f573e15656ed1d to your computer and use it in GitHub Desktop.
Save anonymous/7568e6f573e15656ed1d 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();
equipeTemp = equipe;
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.Remove(j);
equipeTemp.Add(joueur);
break;
}
else
equipeTemp.Add(joueur);
}
}
equipe = equipeTemp;
updateJoueurs(equipe);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment