public static int GetNextModel(List<int> models, int currentModel) { for (int c = 0; c < models.Count; c++) { if (models[c] == currentModel) { if (c == (models.Count - 1)) { return models[0]; } else { return models[c + 1]; } } } return models[0]; }