Skip to content

Class NativeList<T>

Namespace: Apogee.Core.Memory
Assembly: Apogee.Core.dll

A growable list of unmanaged values in unmanaged memory. Must be disposed. Not thread safe.

public sealed class NativeList<T> : IDisposable where T : unmanaged

Type Parameters

T

Inheritance

object ← NativeList<T>

Implements

IDisposable

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

NativeList(int)

public NativeList(int capacity = 4)

Parameters

capacity int

Properties

Capacity

public int Capacity { get; }

Property Value

int

Count

public int Count { get; }

Property Value

int

this[int]

public ref T this[int index] { get; }

Property Value

T

Methods

Add(T)

public void Add(T item)

Parameters

item T

AsSpan()

The items. The span is invalidated by anything that adds to the list.

public Span<T> AsSpan()

Returns

Span<T>

Clear()

public void Clear()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

\~NativeList()

protected ~NativeList()

RemoveAtSwapBack(int)

Removes the item at index by moving the last item into its place (order is not kept).

public void RemoveAtSwapBack(int index)

Parameters

index int

Reserve(int)

public void Reserve(int capacity)

Parameters

capacity int