public static GameSide EnsureDefined(this GameSide side) { switch (side) { case GameSide.White: case GameSide.Black: return(side); default: throw new InvalidEnumArgumentException(nameof(side), (int)side, side.GetType()); } }