Class PooledList<T>
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists. Instances of this type are kept in a pool for recycling.
Inheritance
Namespace: System.Collections.Generic
Assembly: Nuqleon.Memory.dll
Syntax
public class PooledList<T> : List<T>, IFreeable, IClearable
Type Parameters
Name | Description |
---|---|
T | The type of elements in the list. |
Methods
AsReadOnly()
Returns a read-only wrapper for the current collection.
Declaration
public ReadOnlyCollection<T> AsReadOnly()
Returns
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<T> | A System.Collections.ObjectModel.ReadOnlyCollection<> that acts as a read-only wrapper around the current collection. |
AsReadOnlyCopy()
Returns a read-only copy of the current collection.
Declaration
public ReadOnlyCollection<T> AsReadOnlyCopy()
Returns
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<T> | A System.Collections.ObjectModel.ReadOnlyCollection<> that contains a copy of the elements in the current collection. |
AsReadOnlyCopyAndFree()
Returns a read-only copy of the current collection and returns the list to the pool.
Declaration
public ReadOnlyCollection<T> AsReadOnlyCopyAndFree()
Returns
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<T> | A System.Collections.ObjectModel.ReadOnlyCollection<> that contains a copy of the elements in the current collection. |
Free()
Frees the object and returns it to the pool.
Declaration
public void Free()
GetInstance()
Gets a System.Collections.Generic.List<> instance from the global list pool.
Declaration
public static PooledList<T> GetInstance()
Returns
Type | Description |
---|---|
PooledList<T> | A System.Collections.Generic.List<> instance obtained from the global pool. |
New()
Gets a pooled System.Collections.Generic.List<> instance, from the global pool, with RAII capabilities to return it to the pool.
Declaration
public static PooledListHolder<T> New()
Returns
Type | Description |
---|---|
PooledListHolder<T> | Pooled list instance. |
New(ListPool<T>)
Gets a pooled System.Collections.Generic.List<> instance, from the specified pool, with RAII capabilities to return it to the pool.
Declaration
public static PooledListHolder<T> New(ListPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
ListPool<T> | pool | Pool to allocate from. |
Returns
Type | Description |
---|---|
PooledListHolder<T> | Pooled list instance. |
Exceptions
Type | Condition |
---|---|
System.NullReferenceException | Thrown if |