Class LimitedList<TElem>
- Namespace
- Vintagestory.API.Datastructures
- Assembly
- VintagestoryAPI.dll
Holds a limited amount of items, discards the lowest index item when an overflow happens
public class LimitedList<TElem> : IEnumerable<TElem>, IEnumerable
Type Parameters
TElem
- Inheritance
-
LimitedList<TElem>
- Implements
-
IEnumerable<TElem>
- Inherited Members
- Extension Methods
Constructors
LimitedList(int)
Create a new list with a given maximum capacity
public LimitedList(int maxCapacity)
Parameters
maxCapacity
int
LimitedList(int, IEnumerable<TElem>)
Create a new list with a given maximum capacity
public LimitedList(int maxCapacity, IEnumerable<TElem> initialElements)
Parameters
maxCapacity
intinitialElements
IEnumerable<TElem>
Properties
Count
public int Count { get; }
Property Value
this[int]
public TElem this[int index] { get; }
Parameters
index
int
Property Value
- TElem
Methods
Add(TElem)
public void Add(TElem key)
Parameters
key
TElem
Clear()
public void Clear()
GetEnumerator()
Returns an enumerator that iterates through a collection.
public IEnumerator GetEnumerator()
Returns
- IEnumerator
An IEnumerator object that can be used to iterate through the collection.
IsFull()
public bool IsFull()
Returns
LastElement()
public TElem LastElement()
Returns
- TElem
RemoveAt(int)
public void RemoveAt(int i)
Parameters
i
int
SetCapacity(int)
public void SetCapacity(int maxCapacity)
Parameters
maxCapacity
int
ToArray()
public TElem[] ToArray()
Returns
- TElem[]