/// <summary>Initializes a new instance of the <see cref="WeakValueDictionary{TKey,TValue}" /> class.</summary> /// <param name="capacity">Initial capacity.</param> public WeakValueDictionary(int capacity) { _pool = new RequestReturnPool <WeakReference>(capacity, () => new WeakReference(null)); _inner = new Dictionary <TKey, WeakReference>(capacity); _garbageCollectionSentinel = new WeakReference(new object()); _deadKeys = new Queue <KeyValuePair <TKey, WeakReference> >(); }
private RequestReturnPool <WeakReference> GetPool() { return(_pool ?? (_pool = new RequestReturnPool <WeakReference>(_inner.Count, () => new WeakReference(null)))); }