Ejemplo n.º 1
0
 /// <summary>
 /// 添加节点到尾部
 /// </summary>
 /// <param name="pNode"></param>
 /// <returns></returns>
 public DoubleLinkedListNode <T> AddToTail(DoubleLinkedListNode <T> pNode)
 {
     if (pNode == null)
     {
         return(null);
     }
     pNode.next = null;
     if (Head == null)
     {
         Tail = Head = pNode;
     }
     else
     {
         pNode.next = pNode;
         pNode.prev = Tail;
         Tail       = pNode;
     }
     m_Count++;
     return(Tail);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 添加一个节点到头部
 /// </summary>
 /// <param name="pNode"></param>
 /// <returns></returns>
 public DoubleLinkedListNode <T> AddToHeader(DoubleLinkedListNode <T> pNode)
 {
     if (pNode == null)
     {
         return(null);
     }
     pNode.prev = null;
     if (Head == null)
     {
         Head = Tail = pNode;
     }
     else
     {
         pNode.next = Head;
         pNode.prev = pNode;
         Head       = pNode;
     }
     m_Count++;
     return(Head);
 }