BattleShip.Core.GameHost.FindPlayerByEmail C# (CSharp) Method

FindPlayerByEmail() private method

private FindPlayerByEmail ( Game game, string playerEmail ) : Player
game Game
playerEmail string
return Player
        private Player FindPlayerByEmail(Game game, string playerEmail)
        {
            if (game.Player1.Email == playerEmail)
            {
                return game.Player1;
            }

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

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