Beispiel #1
0
        public void Clear()
        {
            LinkedListNode <T> linkedListNode1 = this.head;

            while (linkedListNode1 != null)
            {
                LinkedListNode <T> linkedListNode2 = linkedListNode1;
                linkedListNode1 = linkedListNode1.Next;
                linkedListNode2.Invalidate();
            }
            this.head  = (LinkedListNode <T>)null;
            this.count = 0;
            ++this.version;
        }
Beispiel #2
0
        public void Clear()
        {
            LinkedListNode <T> head = this.head;

            while (head != null)
            {
                LinkedListNode <T> node2 = head;
                head = head.Next;
                node2.Invalidate();
            }
            this.head  = null;
            this.count = 0;
            this.version++;
        }
Beispiel #3
0
        public void Clear()
        {
            LinkedListNode <T> current = head;

            while (current != null)
            {
                LinkedListNode <T> temp = current;
                current = current.Next;   // use Next the instead of "next", otherwise it will loop forever
                temp.Invalidate();
            }

            head  = null;
            count = 0;
            version++;
        }
Beispiel #4
0
        public void Clear()
        {
            LinkedListNode <T>?current = head;

            while (current != null)
            {
                LinkedListNode <T> temp = current;
                current = current.Next;
                temp.Invalidate();
            }

            head  = null;
            count = 0;
            version++;
        }
Beispiel #5
0
 internal void InternalRemoveNode(LinkedListNode <T> node)
 {
     if (node.next == node)
     {
         this.head = (LinkedListNode <T>)null;
     }
     else
     {
         node.next.prev = node.prev;
         node.prev.next = node.next;
         if (this.head == node)
         {
             this.head = node.next;
         }
     }
     node.Invalidate();
     --this.count;
     ++this.version;
 }
Beispiel #6
0
 internal void InternalRemoveNode(LinkedListNode <T> node)
 {
     Debug.Assert(node.list == this, "Deleting the node from another list!");
     Debug.Assert(head != null, "This method shouldn't be called on empty list!");
     if (node.next == node)
     {
         Debug.Assert(count == 1 && head == node, "this should only be true for a list with only one node");
         head = null;
     }
     else
     {
         node.next.prev = node.prev;
         node.prev.next = node.next;
         if (head == node)
         {
             head = node.next;
         }
     }
     node.Invalidate();
     count--;
     version++;
 }