Exemplo n.º 1
0
 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();
     }));
 }
Exemplo n.º 2
0
 private Node GetNode(TKey key)
 {
     return(LockWrapper.ReadLock(_locker, Timeout, () =>
     {
         WeakReference value;
         return (Node)(_index.TryGetValue(key, out value) ? value.Target : null);
     }));
 }