コード例 #1
0
        public void AddLast(T value)
        {
            var element = new DoubleLinkedNode <T>(value);

            if (Count == 0)
            {
                First = element;
                Last  = element;
            }
            else
            {
                var temp = Last;
                Last.Next    = element;
                Last         = element;
                element.Prev = temp;
            }

            Count++;
        }
コード例 #2
0
        public void AddFirst(T value)
        {
            var element = new DoubleLinkedNode <T>(value);
            var temp    = First;

            element.Next = temp;
            First        = element;

            if (Count == 0)
            {
                Last = First;
            }
            else
            {
                temp.Prev = First;
            }

            Count++;
        }