public void Prepend(T value)
        {
            var node = new DoubleLinkedListItem <T>(value);

            if (Head == null)
            {
                Head = Tail = new DoubleLinkedListItem <T>(value);
            }
            else
            {
                node.NextItem     = Head;
                Head.PreviousItem = node;
                Head = node;
            }
        }
        public bool DeleteTail()
        {
            if (Tail != null)
            {
                if (Tail.PreviousItem != null)
                {
                    Tail          = Tail.PreviousItem;
                    Tail.NextItem = null;
                }
                else
                {
                    Tail = Head = null;
                }
                return(true);
            }

            return(false);
        }
        public bool DeleteHead()
        {
            if (Head != null)
            {
                if (Head.NextItem != null)
                {
                    Head = Head.NextItem;
                    Head.PreviousItem = null;
                }
                else
                {
                    Tail = Head = null;
                }
                return(true);
            }

            return(false);
        }
        public bool Delete(T value)
        {
            if (Head == null)
            {
                return(false);
            }

            var current = Head;

            while (current.NextItem != null)
            {
                if (current.Value.Equals(value))
                {
                    if (current != Head)
                    {
                        current.PreviousItem.NextItem = current.NextItem;
                        current.NextItem.PreviousItem = current.PreviousItem;
                    }
                    else
                    {
                        current.PreviousItem = null;
                        Head = current;
                    }

                    return(true);
                }

                current = current.NextItem;
            }

            if (current.Value.Equals(value))
            {
                Tail          = current.PreviousItem;
                Tail.NextItem = null;
                return(true);
            }

            return(false);
        }
 public void Reset()
 {
     _currentItem = null;
 }
            public bool MoveNext()
            {
                _currentItem = _currentItem == null ? _list.Head : _currentItem.NextItem;

                return(_currentItem != null);
            }
 public DoubleLinkedList(T value)
 {
     Head = Tail = new DoubleLinkedListItem <T>(value);
 }