Table of Contents

Struct PoolListStruct<T>

Namespace
Stride.Core.Collections
Assembly
Stride.Core.dll

A pool of objects allocated and can be cleared without losing previously allocated instance.

public struct PoolListStruct<T> : IEnumerable<T>, IEnumerable where T : class

Type Parameters

T

Type of the pooled object

Implements
Inherited Members
Extension Methods

Constructors

PoolListStruct(int, Func<T>)

Initializes a new instance of the PoolListStruct<T> struct.

public PoolListStruct(int capacity, Func<T> factory)

Parameters

capacity int

The capacity.

factory Func<T>

The factory.

Exceptions

ArgumentNullException

factory

Fields

Count

The number of objects in use, readonly.

public int Count

Field Value

int

Properties

this[int]

Gets or sets the item at the specified index.

public T this[int index] { get; set; }

Parameters

index int

The index.

Property Value

T

An instance of T

this[uint]

Gets or sets the item at the specified index.

public T this[uint index] { get; set; }

Parameters

index uint

The index.

Property Value

T

An instance of T

Methods

Add()

Adds a new object in use to this instance.

public T Add()

Returns

T

An instance of T

Clear()

Clears objects in use and keep allocated objects.

public void Clear()

GetEnumerator()

public FastListStruct<T>.Enumerator GetEnumerator()

Returns

FastListStruct<T>.Enumerator

IndexOf(T)

Gets the index of item

public int IndexOf(T item)

Parameters

item T

The item to get the index of

Returns

int

Index of the item, or -1 if the item is not in this list

Remove(T)

Removes the object from the list

public void Remove(T item)

Parameters

item T

The item to remove

Remarks

The item is added back in the pool to be reused for the next Add()

RemoveAt(int)

public void RemoveAt(int index)

Parameters

index int

Reset()

Resets this instance by releasing allocated objects.

public void Reset()