Пример #1
0
        public void AddPlayer(Players player)
        {
            if (CheckIfPlayerExists(player))
            {
                throw new InvalidOperationException("The player already exists.");
            }

            else
            {
                this.players.Add(player);
            }
        }
Пример #2
0
 public bool CheckIfPlayerExists(Players player)
 {
     return this.players.Any(p => p.FirstName == player.FirstName && p.LastName == p.LastName);
 }