Table of Contents

Class ListPool<T>

Namespace
Exiled.API.Features.Pools
Assembly
Exiled.API.dll

Defines a system used to store and retrieve List<T> objects.

public class ListPool<T> : IPool<List<T>>

Type Parameters

T

The type of the objects in the list.

Inheritance
ListPool<T>
Implements
Inherited Members
Extension Methods

Properties

Pool

Gets a ListPool<T> that stores lists.

public static ListPool<T> Pool { get; }

Property Value

ListPool<T>

Methods

Get()

Retrieves a stored object of type System.Collections.Generic.List{`0}, or creates it if it does not exist.

public List<T> Get()

Returns

List<T>

The stored object, or a new object, of type System.Collections.Generic.List{`0}.

Get(IEnumerable<T>)

Retrieves a stored object of type List<T>, or creates it if it does not exist. The list will be filled with all the provided items.

public List<T> Get(IEnumerable<T> items)

Parameters

items IEnumerable<T>

The items to fill the list with.

Returns

List<T>

The stored object, or a new object, of type List<T>.

Get(int)

Retrieves a stored object of type List<T>, or creates it if it does not exist. The capacity of the list will be equal to or greater than capacity.

public List<T> Get(int capacity)

Parameters

capacity int

The capacity of content in the List<T>.

Returns

List<T>

The stored object, or a new object, of type List<T>.

Return(List<T>)

Returns the object to the pool.

public void Return(List<T> obj)

Parameters

obj List<T>

The object to return, of type System.Collections.Generic.List{`0}.

ToArrayReturn(List<T>)

Returns the List<T> to the pool and returns its contents as an array.

public T[] ToArrayReturn(List<T> obj)

Parameters

obj List<T>

The List<T> to return.

Returns

T[]

The contents of the returned list as an array.

See Also

DictionaryPool<TKey, TValue>
HashSetPool<T>