Пример #1
0
        public T PopAt(int index)
        {
            if (index == 0)
            {
                return(Pop());
            }
            SetOfStacks <T> cursor = _previous;

            while (index-- > 0)
            {
                if (cursor._previous == null)
                {
                    throw new ArgumentOutOfRangeException();
                }
                cursor = cursor._previous;
            }
            return(cursor.Pop());
        }