Struct FixedList<T>
- Namespace
- GB
- Assembly
- GBSharp.Framework.dll
A fixed-capacity list: storage reserved up front, with a live count.
public struct FixedList<T> where T : struct
Type Parameters
T
- Inherited Members
Examples
[Capacity(8)]
private static FixedList<Enemy> enemies;
Remarks
This is the answer GBS0042 points List<T> at. It cannot grow,
which is the point: the memory it occupies is decided when it is declared,
not while the game is running.
Properties
Capacity
The capacity, known at compile time and folded into a constant.
public readonly byte Capacity { get; }
Property Value
Count
How many items the list currently holds.
public readonly byte Count { get; }
Property Value
this[byte]
public ref T this[byte index] { get; }
Parameters
indexbyte
Property Value
- T
Methods
Add(T)
Appends an item. Returns false when the list is full: there is nowhere to grow into, so the caller decides what that means.
public bool Add(T item)
Parameters
itemT
Returns
Clear()
Sets the count to zero. The storage is untouched.
public void Clear()
RemoveAt(byte)
Removes the item at index by moving the last item
into its place. Cheap, and does not preserve order.
public void RemoveAt(byte index)
Parameters
indexbyte