コード例 #1
0
 public int GetPlayerScore(Player player)
 {
     foreach (var i in Pairings)
     {
         if (player.Equals(i.Player1))
         {
             return i.P1Score;
         }
         if (player.Equals(i.Player2))
         {
             return i.P2Score;
         }
     }
     throw new ArgumentException("Player not found!");
 }
コード例 #2
0
 public Player GetOpponent(Player player)
 {
     if (!ContainsPlayers(player))
     {
         throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Player '{0}' does not exist in this pairing", player.Name));
     }
     return player.Equals(Player1) ? Player2 : Player1;
 }