private void ClearCore() { DomNode current = _head; while (current != null) { DomNode temp = current; current = current.Next; // use Next the instead of "next", otherwise it will loop forever temp.Invalidate(); } _head = null; count = 0; version++; }
internal void InternalRemoveNode(DomNode node) { 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++; }