Class PooledHashSet<T>
Represents a set of values.To browse the .NET Framework source code for this type, see the Reference Source. Instances of this type are kept in a pool for recycling.
Inheritance
Namespace: System.Collections.Generic
Assembly: Nuqleon.Memory.dll
Syntax
public class PooledHashSet<T> : HashSet<T>, IFreeable, IClearable
Type Parameters
Name | Description |
---|---|
T | The type of elements in the hash set. |
Constructors
PooledHashSet(SerializationInfo, StreamingContext)
Initializes a new instance of the PooledHashSet<T> class with serialized data.
Declaration
protected PooledHashSet(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | A System.Runtime.Serialization.SerializationInfo object containing the information required to serialize the PooledHashSet<T>. |
System.Runtime.Serialization.StreamingContext | context | A System.Runtime.Serialization.StreamingContext structure containing the source and destination of the serialized stream associated with the PooledHashSet<T>. |
Methods
Free()
Frees the object and returns it to the pool.
Declaration
public void Free()
GetInstance()
Gets a System.Collections.Generic.HashSet<> instance from the global hash set pool.
Declaration
public static PooledHashSet<T> GetInstance()
Returns
Type | Description |
---|---|
PooledHashSet<T> | A System.Collections.Generic.HashSet<> instance obtained from the global pool. |
New()
Gets a pooled System.Collections.Generic.HashSet<> instance, from the global pool, with RAII capabilities to return it to the pool.
Declaration
public static PooledHashSetHolder<T> New()
Returns
Type | Description |
---|---|
PooledHashSetHolder<T> | Pooled hash set instance. |
New(HashSetPool<T>)
Gets a pooled System.Collections.Generic.HashSet<> instance, from the specified pool, with RAII capabilities to return it to the pool.
Declaration
public static PooledHashSetHolder<T> New(HashSetPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
HashSetPool<T> | pool | Pool to allocate from. |
Returns
Type | Description |
---|---|
PooledHashSetHolder<T> | Pooled hash set instance. |
Exceptions
Type | Condition |
---|---|
System.NullReferenceException | Thrown if |