Class DictionaryPool<TKey, TValue>
Defines a system used to store and retrieve Dictionary<TKey, TValue> objects.
public class DictionaryPool<TKey, TValue> : IPool<Dictionary<TKey, TValue>>
Type Parameters
TKey
The type of the key in the dictionary.
TValue
The type of the value in the dictionary.
- Inheritance
-
DictionaryPool<TKey, TValue>
- Implements
-
IPool<Dictionary<TKey, TValue>>
- Inherited Members
- Extension Methods
Properties
Pool
Gets a DictionaryPool<TKey, TValue> that stores dictionaries.
public static DictionaryPool<TKey, TValue> Pool { get; }
Property Value
- DictionaryPool<TKey, TValue>
Methods
Get()
Rent a Dictionary<TKey, TValue> temporarily.
public Dictionary<TKey, TValue> Get()
Returns
- Dictionary<TKey, TValue>
Get(IEnumerable<KeyValuePair<TKey, TValue>>)
Rent a Dictionary<TKey, TValue> temporarily. Fills it with the provided IEnumerable<T> of KeyValuePair<TKey, TValue>.
public Dictionary<TKey, TValue> Get(IEnumerable<KeyValuePair<TKey, TValue>> pairs)
Parameters
pairs
IEnumerable<KeyValuePair<TKey, TValue>>The items to fill the dictionary with.
Returns
- Dictionary<TKey, TValue>
Return(Dictionary<TKey, TValue>)
Returns a finished Dictionary<TKey, TValue> to the pool, clearing all of its contents.
public void Return(Dictionary<TKey, TValue> obj)
Parameters
obj
Dictionary<TKey, TValue>The Dictionary<TKey, TValue> to return.
ToArrayReturn(Dictionary<TKey, TValue>)
Returns the Dictionary<TKey, TValue> to the pool and returns its contents as an array.
public KeyValuePair<TKey, TValue>[] ToArrayReturn(Dictionary<TKey, TValue> obj)
Parameters
obj
Dictionary<TKey, TValue>The Dictionary<TKey, TValue> to return.
Returns
- KeyValuePair<TKey, TValue>[]
The contents of the returned dictionary as an array.
See Also
ListPool<T>
HashSetPool<T>