NoAllocListExtensions
2 min read • 315 wordsnamespace InitialPrefabs.Collections
void Clear<T>(this ref NoAllocList<T> list)
Resets the counter internally to 0. Does not clear out the memory so the elements still persist. As far as the list is aware, there is nothing stored.
Any type implementing IEquatable{T}
| Parameter | Description |
|---|---|
| list | A reference to the NoAllocList{T} |
void Add<T>(this ref NoAllocList<T> list, T item)
Adds an element to the list.
Any type implementing IEquatable{T}
| Parameter | Description |
|---|---|
| list | A reference to the NoAllocList{T} |
| item | An element to store into the list. |
void RemoveAtSwapback<T>(this ref NoAllocList<T> list, int index)
Swaps the element at the index with the very last element of the list.
Any type implementing IEquatable{T}
| Parameter | Description |
|---|---|
| list | A reference to the NoAllocList{T} |
| index | The index to remove at |
void RemoveAt<T>(this ref NoAllocList<T> list, int index)
Removes an element at the index and shifts all succeeding elements down 1.
Any type implementing IEquatable{T}
| Parameter | Description |
|---|---|
| list | A reference to the NoAllocList{T} |
| index | The index to remove at |
ref T ElementAt<T>(this ref NoAllocList<T> list, int index)
Gets a reference to the element at the index.
Any type implementing IEquatable{T}
| Parameter | Description |
|---|---|
| list | A reference to the NoAllocList{T} |
| index | The index to get the reference at |
ref T - A reference to the element at the index
int IndexOf<T>(this in NoAllocList<T> list, T item)
Attempst to find the element at an index.
Any type implementing IEquatable{T}
| Parameter | Description |
|---|---|
| list | A reference to the NoAllocList{T} |
| item | The element to find in the list |
int - The index of the element if found, otherwise -1 if it doesn’t exist
Go back to API Home