public IEnumerator <KeyValuePair <TKey, TItem> > GetEnumerator() { return(LockWrapper.ReadLock(_locker, Timeout, () => { return _index.Where(t => t.Value.IsAlive).Select(t => new KeyValuePair <TKey, TItem>(t.Key, (TItem)t.Value.Target)).ToList().GetEnumerator(); })); }
private Node GetNode(TKey key) { return(LockWrapper.ReadLock(_locker, Timeout, () => { WeakReference value; return (Node)(_index.TryGetValue(key, out value) ? value.Target : null); })); }