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

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

public static GetPreviousKey ( Dictionary models, int currentModel ) : int
models Dictionary
currentModel int
Результат int
        public static int GetPreviousKey(Dictionary<int, List<int>> models, int currentModel)
        {
            int prevModel = -1;
            foreach (int key in models.Keys)
            {
                if (key == currentModel)
                {
                    if (prevModel != -1)
                    {
                        return prevModel;
                    }
                }
                prevModel = key;
            }
            return prevModel;
        }