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!"); }
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; }