private void InsertGame(GameInfo gameInfo) { var gameName = gameInfo.GameName; var length = ServerGames.Count; var inserted = false; for (int i = 0; i < length; i++) { var comparison = ServerGames[i].GameName.CompareTo(gameName); if (comparison == 0) { inserted = true; break; } if (comparison > 0) { ServerGames.Insert(i, gameInfo); inserted = true; break; } } if (!inserted) { ServerGames.Add(gameInfo); } }