PoolListStruct<T> Struct
Namespace: Stride.Core.CollectionsAssembly: Stride.Core.dll
A pool of objects allocated and can be cleared without loosing previously allocated instance.
public struct PoolListStruct<T> : IEnumerable<T>, IEnumerable where T : class
Type Parameters
| Name | Description |
|---|---|
| T | Type of the pooled object |
| Name | Description | |
|---|---|---|
| Constructors | ||
| PoolListStruct(Int32, Func<T>) | Initializes a new instance of the PoolListStruct<T> struct. |
|
| Fields | ||
| Count | The number of objects in use, readonly. |
|
| Properties | ||
| Item[Int32] | Gets or sets the item at the specified index. |
|
| Item[UInt32] | Gets or sets the item at the specified index. |
|
| Methods | ||
| Add() | Adds a new object in use to this instance. |
|
| Clear() | Clears objects in use and keep allocated objects. |
|
| GetEnumerator() | ||
| IndexOf(T) | Gets the index of |
|
| Remove(T) | Removes the object from the list |
|
| RemoveAt(Int32) | ||
| Reset() | Resets this instance by releasing allocated objects. |
|
| Explicit Interface Implementations | ||
| IEnumerable<T>.GetEnumerator() | ||
| IEnumerable.GetEnumerator() | ||
Constructors
PoolListStruct(Int32, Func<T>)
Initializes a new instance of the PoolListStruct<T> struct.
public PoolListStruct(int capacity, Func<T> factory)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | capacity | The capacity. |
| System.Func<T> | factory | The factory. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | factory |
Fields
Count
The number of objects in use, readonly.
public int Count
Field Value
| Type | Description |
|---|---|
| System.Int32 |
Properties
Item[Int32]
Gets or sets the item at the specified index.
public T this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The index. |
Property Value
| Type | Description |
|---|---|
| T | An instance of T |
Item[UInt32]
Gets or sets the item at the specified index.
public T this[uint index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | index | The index. |
Property Value
| Type | Description |
|---|---|
| T | An instance of T |
Methods
Add()
Adds a new object in use to this instance.
public T Add()
Returns
| Type | Description |
|---|---|
| T | An instance of T |
Clear()
Clears objects in use and keep allocated objects.
public void Clear()
GetEnumerator()
public FastListStruct<T>.Enumerator GetEnumerator()
Returns
| Type | Description |
|---|---|
| FastListStruct.Enumerator<> |
IndexOf(T)
Gets the index of item
public int IndexOf(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | The item to get the index of |
Returns
| Type | Description |
|---|---|
| System.Int32 | 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
| Type | Name | Description |
|---|---|---|
| T | item | The item to remove |
Remarks
The item is added back in the pool to be reused for the next Add()
RemoveAt(Int32)
public void RemoveAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index |
Reset()
Resets this instance by releasing allocated objects.
public void Reset()
Explicit Interface Implementations
IEnumerable<T>.GetEnumerator()
IEnumerator<T> IEnumerable<T>.GetEnumerator()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerator<T> |
IEnumerable.GetEnumerator()
IEnumerator IEnumerable.GetEnumerator()
Returns
| Type | Description |
|---|---|
| System.Collections.IEnumerator |