Beispiel #1
0
        public void AddPlayer(Player player)
        {
            if (CheckIfPlayerExists(player))
            {
                throw new InvalidOperationException("Player already exists in this team");
            }

            this.players.Add(player);
        }
Beispiel #2
0
 private bool CheckIfPlayerExists(Player player)
 {
     return this.players.Any(p => p.FirstName == player.FirstName &&
         p.LastName == player.LastName);
 }