DynamicBufferExtensions
The writes of a DynamicBuffer. The DynamicBufferExtensions class of EasyEcs, the C# ECS: its members, parameters and complexity.
public static class DynamicBufferExtensionsThe writes of a DynamicBuffer. Each takes the buffer by ref: it must be reached through a write access (a tracked change), never through in.
Methods
Add
public static void Add<T>(this ref DynamicBuffer<T> buffer, in T item);Append item. O(1) amortized; allocates only when the list grows.
Complexity (API table): O(1) amortized / O(items)
AddRange
public static void AddRange<T>(this ref DynamicBuffer<T> buffer, ReadOnlySpan<T> items);Append items. O(items).
Complexity (API table): O(1) amortized / O(items)
AsSpan
public static Span<T> AsSpan<T>(this ref DynamicBuffer<T> buffer);The elements, writable.
Complexity (API table): O(count) when it grows / O(1)
Clear
public static void Clear<T>(this ref DynamicBuffer<T> buffer);Remove every element; the capacity stays. O(1), or O(count) for elements holding references.
Complexity (API table): O(1), O(count) for elements with references
EnsureCapacity
public static void EnsureCapacity<T>(this ref DynamicBuffer<T> buffer, int capacity);Make room for at least capacity elements.
Complexity (API table): O(count) when it grows / O(1)
Insert
public static void Insert<T>(this ref DynamicBuffer<T> buffer, int index, in T item);Insert item at index, keeping the order. O(count).
Complexity (API table): O(count)
RemoveAt
public static void RemoveAt<T>(this ref DynamicBuffer<T> buffer, int index);Remove the element at index, keeping the order. O(count).
Complexity (API table): O(count)
RemoveAtSwapBack
public static void RemoveAtSwapBack<T>(this ref DynamicBuffer<T> buffer, int index);Remove the element at index by moving the last one into its place. O(1).
Complexity (API table): O(1)
TrimExcess
public static void TrimExcess<T>(this ref DynamicBuffer<T> buffer);Shrink the capacity to the count, so a list that once grew large stops holding its peak (the list's array is reallocated; an empty list holds none). O(count).
Complexity (API table): O(count)
Last updated on
How is this guide?