public void DeleteNode(int index)
        {
            DLinkedListNode <T> node;
            DLinkedListNode <T> currentNode;

            if (Head == null)
            {
                return;
            }
            else if (index < 0 || index > Count)
            {
                throw new Exception("Index out of bounds");
            }
            else if (index == 0)
            {
                var p = Head;
                currentNode = Head.Next;
                _firstNode  = currentNode;
                p           = null;
                return;
            }
            else
            {
                int i = 1;
                currentNode = Head.Next;
                while (i <= index)
                {
                    var p = currentNode.Next;
                    currentNode = currentNode.Next.Next;
                    p.Data      = default(T);
                    p.Next      = null;
                }
                return;
            }
        }
 public void AppendNode(DLinkedListNode <T> newNode)
 {
     if (Head == null)
     {
         _firstNode = _lastNode = newNode;
     }
     else
     {
         newNode.Next        = _firstNode;
         newNode.Previous    = _firstNode.Previous;
         _firstNode.Previous = newNode;
     }
 }
        public void InsertNewNode(DLinkedListNode <T> newNode, int index)
        {
            int currentIndex = 0;
            DLinkedListNode <T> currentNode;

            if (newNode == null)
            {
                return;
            }

            if (index == 0)
            {
                PrependNode(newNode);
            }
            else if (index == Count)
            {
                AppendNode(newNode);
            }
            else if (Head == null)
            {
                Head = newNode = LastNode;
            }
            else
            {
                currentNode = Head;
                while (currentNode.Next != Head)
                {
                    if (currentIndex == index)
                    {
                        var p = currentNode.Next;
                        currentNode.Next = newNode;
                        newNode.Previous = currentNode;
                        newNode.Next     = p;
                        p.Previous       = newNode;
                    }
                    currentIndex++;
                    currentNode = currentNode.Next;
                }
            }
        }
 public DLinkedListNode(T value, DLinkedListNode <T> nextNode, DLinkedListNode <T> prevNode)
 {
     Data     = value;
     Next     = nextNode;
     Previous = prevNode;
 }
 public DLinkedListNode(T value)
 {
     Data     = value;
     Next     = null;
     Previous = null;
 }