BattleShip.Core.GameHost.FindOpponentByPlayerEmail C# (CSharp) 메소드

FindOpponentByPlayerEmail() 개인적인 메소드

private FindOpponentByPlayerEmail ( Game game, string playerEmail ) : Player
game Game
playerEmail string
리턴 Player
        private Player FindOpponentByPlayerEmail(Game game, string playerEmail)
        {
            if (game.Player1.Email == playerEmail)
            {
                return game.Player2;
            }

            if (game.Player2.Email == playerEmail)
            {
                return game.Player1;
            }

            throw new InvalidOperationException("No such player.");
        }