ACR_Items.ItemModels.GetPreviousModel C# (CSharp) Метод

GetPreviousModel() публичный статический Метод

public static GetPreviousModel ( List models, int currentModel ) : int
models List
currentModel int
Результат int
        public static int GetPreviousModel(List<int> models, int currentModel)
        {
            for (int c = 0; c < models.Count; c++)
            {
                if (models[c] == currentModel)
                {
                    if (c == 0)
                    {
                        return models[models.Count - 1];
                    }
                    else
                    {
                        return models[c - 1];
                    }
                }
            }
            return models[0];
        }