Class HashSetPool<T>
Defines a system used to store and retrieve HashSet<T> objects.
public class HashSetPool<T> : IPool<HashSet<T>>
Type Parameters
T
The type of the objects in the hash set.
- Inheritance
-
HashSetPool<T>
- Implements
- Inherited Members
- Extension Methods
Properties
Pool
Gets a HashSetPool<T> that stores hash sets.
public static HashSetPool<T> Pool { get; }
Property Value
- HashSetPool<T>
Methods
Get()
Retrieves a stored object of type System.Collections.Generic.HashSet{`0}, or creates it if it does not exist.
public HashSet<T> Get()
Returns
- HashSet<T>
The stored object, or a new object, of type System.Collections.Generic.HashSet{`0}.
Get(IEnumerable<T>)
Retrieves a stored object of type HashSet<T>, or creates it if it does not exist. The hashset will be filled with all the provided items
.
public HashSet<T> Get(IEnumerable<T> items)
Parameters
items
IEnumerable<T>The items to fill the hashset with.
Returns
- HashSet<T>
The stored object, or a new object, of type HashSet<T>.
Return(HashSet<T>)
Returns the object to the pool.
public void Return(HashSet<T> obj)
Parameters
obj
HashSet<T>The object to return, of type System.Collections.Generic.HashSet{`0}.
ToArrayReturn(HashSet<T>)
Returns the HashSet<T> to the pool and returns its contents as an array.
public T[] ToArrayReturn(HashSet<T> obj)
Parameters
obj
HashSet<T>The HashSet<T> to return.
Returns
- T[]
The contents of the returned hashset as an array.