Class NativeBuffer<TItem, TTracker>
public sealed class NativeBuffer<TItem, TTracker> : IDisposable where TItem : unmanaged where TTracker : struct, INativeAllocationTracker
Type Parameters
TItemTTracker
- Inheritance
-
NativeBuffer<TItem, TTracker>
- Implements
- Inherited Members
Constructors
NativeBuffer(int, bool, TTracker)
Creates a native buffer sized for elementCount elements of TItem.
public NativeBuffer(int elementCount, bool zeroFill = true, TTracker tracker = default)
Parameters
elementCountintNumber of elements.
zeroFillboolIf true, the buffer is zeroed. Set to false if the caller will initialize the entire span itself.
trackerTTrackerAllows native allocation sizes to be tracked and affect the GC.
Properties
ByteSpan
Gets a Span<T> over the raw bytes of the native buffer.
public Span<byte> ByteSpan { get; }
Property Value
Length
Number of TItem elements that fit in the buffer.
public int Length { get; }
Property Value
Span
Gets a Span<T> over the native buffer.
public Span<TItem> Span { get; }
Property Value
- Span<TItem>
Methods
Build()
Transfers ownership to an ArrowBuffer. This instance becomes unusable.
public ArrowBuffer Build()
Returns
Dispose()
public void Dispose()
Grow(int, bool)
Grows the buffer to hold at least newElementCount elements,
preserving existing data.
public void Grow(int newElementCount, bool zeroFill = true)