void Add(DoublyLinking <T> node, DoublyLinking <T> selected, bool isnEnd = true)
 {
     ++Length;
     if (selected == null)
     {
         head = current = end = node;
         return;
     }
     node.PreviousLinq = isnEnd ? selected?.PreviousLinq : selected;
     node.NextLinq     = isnEnd ? selected : null;
     if (isnEnd)
     {
         if (node.PreviousLinq != null)
         {
             selected.PreviousLinq.NextLinq = node;
             selected.PreviousLinq          = node;
         }
         else
         {
             selected.PreviousLinq = node;
             head = node;
         }
     }
     else
     {
         selected.NextLinq = node;
         end = node;
     }
 }
        public void DeleteCurrent()
        {
            if (current == null)
            {
                throw new DeleteNullExeption();
            }

            --Length;
            if (Length == 1)
            {
                end = head = current = null;
                return;
            }


            DoublyLinking <T> buffer = null;

            buffer = current == head ? current.NextLinq : current.PreviousLinq;
            if (current == head)
            {
                head = current.NextLinq;
            }
            else if (current == end)
            {
                end = current.PreviousLinq;
            }
            else
            {
                current.PreviousLinq.NextLinq = current.NextLinq;
                current.NextLinq.PreviousLinq = current.PreviousLinq;
            }
            current = buffer;
        }
        public void ChangeCurrent(int count = 1)
        {
            if (count == 0)
            {
                return;
            }
            int indexOfCurrentAfterChange = GetIndexOfCurrent() + count;

            if ((indexOfCurrentAfterChange < 0) || (indexOfCurrentAfterChange > Length - 1))
            {
                throw new MoveExeption();
            }
            DoublyLinking <T> GetNextLinq() => current.NextLinq;
            DoublyLinking <T> GetPreviousLinq() => current.PreviousLinq;

            Func <DoublyLinking <T> > getLinq = count > 0 ? (Func <DoublyLinking <T> >)GetNextLinq : GetPreviousLinq;

            for (var i = 0; i < Math.Abs(count); ++i)
            {
                current = getLinq();
            }
        }
 public void GoToEnd()
 {
     current = end;
 }
 public void GoToHead()
 {
     current = head;
 }
 internal DoublyLinking(T value)
 {
     PreviousLinq = null;
     Value        = value;
     NextLinq     = null;
 }