コード例 #1
0
        public T Pop()
        {
            if (_list.Count == 0)
            {
                throw new InvalidOperationException("Stack empty");
            }

            T res = _list.Head.Data;

            _list.RemoveFirst();
            return(res);
        }
コード例 #2
0
ファイル: Queue.cs プロジェクト: HavyTheCat/DataStructures
        public T Dequeue()
        {
            if (_itemsList.Count == 0)
            {
                throw new InvalidOperationException("queue empty");
            }

            T res = _itemsList.Head.Data;

            _itemsList.RemoveFirst();
            return(res);
        }