public void Reset() { InUse = false; Current = null; m_current = m_list.First; m_version = m_list.Version; }
private void CacheNode(LALinkedListNode <TYPE> node) { node.Value = null; node.Next = null; if (m_cache.Count < MaxCacheSize) { m_cache.Add(node); } }
public bool MoveNext() { if (m_version != m_list.Version) { throw new InvalidOperationException("Collection was modified after the enumerator was insantiated"); } if (m_current == null) { InUse = false; return(false); } else { Current = m_current.Value; m_current = m_current.Next; return(true); } }
public void Remove(TYPE item) { Version++; if (Count == 0) { return; } if (item == First.Value) { RemoveFirst(); } else if (item == Last.Value) { RemoveLast(); } { LALinkedListNode <TYPE> previous = null; LALinkedListNode <TYPE> current = First; while (current != null) { if (item == current.Value) { previous.Next = current.Next; Count--; CacheNode(current); return; } previous = current; current = current.Next; } } }
public LALinkedListEnumerator(LALinkedList <TYPE> list) { m_list = list; m_current = list.First; m_version = list.Version; }