コード例 #1
0
ファイル: Team.cs プロジェクト: exploitx3/FootballLeague
 public void AddPlayer(Player player)
 {
     if (CheckIfPlayerExists(player))
     {
         throw new InvalidOperationException("The Player already exists in the team.");
     }
     else
     {
         this.players.Add(player);
     }
 }
コード例 #2
0
ファイル: Team.cs プロジェクト: exploitx3/FootballLeague
 private bool CheckIfPlayerExists(Player player)
 {
     return this.players.Any(p => p.FirstName == player.FirstName && p.LastName == player.LastName);
 }