private LinkedListNode <T> NewNode() { if (_freeNodes == null) { return(new LinkedListNode <T>()); } else { LinkedListNode <T> node = _freeNodes; _freeNodes = _freeNodes.next; node.Dispose(); return(node); } }
private void FreeNode(LinkedListNode <T> node) { if (node == null) { return; } node.Dispose(); if (_freeNodes == null) { _freeNodes = node; } else { LinkedListNode <T> fNode = _freeNodes; while (fNode.next != null) { fNode = fNode.next; } fNode.next = node; } }