public virtual MruNode <V> Add(V item) { var node = new MruNode <V>(item, this); try { SlimLock.EnterWriteLock(); node.Next = Head; Tail = Tail ?? node; if (Head != null) { Head.Previous = node; } Head = node; ItemCount++; if (ItemCount > Limit) { var deleted = Tail; if (Tail != null) { Tail = Tail.Previous; deleted.Erase(); } ItemCount--; } } finally { SlimLock.ExitWriteLock(); } return(node); }
public bool MoveNext() { var can = current.Next.Equals(default(V)); if (can) { current = current.Next; } return(can); }
public void Reset() { current = list.Head; }
public void Dispose() { list = null; current = null; }
public MruNode(MruList <V> list, MruNode <V> previous, V value) { List = list; Previous = previous; Value = value; }