DotNext by Roman Sakno

<PackageReference Include="DotNext" Version="2.9.0" />

 PooledArrayBufferWriter<T>

Represents memory writer that is backed by the array obtained from the pool.
public ref T this[int index] { get; }

Gets the element at the specified index.

public ArraySegment<T> WrittenArray { get; }

Gets the daya written to the underlying array so far.

public PooledArrayBufferWriter(ArrayPool<T> pool, int initialCapacity)

Initializes a new writer with the specified initial capacity.

Initializes a new writer with the default initial capacity.

Initializes a new writer with the default initial capacity and Shared as the array pooling mechanism.

public PooledArrayBufferWriter(int initialCapacity)

Initializes a new writer with the specified initial capacity and Shared as the array pooling mechanism.

public ArraySegment<T> GetArray(int sizeHint = 0)

Returns the memory to write to that is at least the requested size.