DotNext by .NET Foundation and Contributors

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

.NET API 495,000 bytes

 IGrowableBuffer<T>

Represents common interface for growable buffer writers.
long? Capacity { get; }

Gets the maximum number of elements that can hold this buffer.

long WrittenCount { get; }

Gets the number of written elements.

void Clear()

Clears the contents of the writer.

void CopyTo<TConsumer>(TConsumer consumer) where TConsumer : IReadOnlySpanConsumer<T>

Passes the contents of this writer to the callback.

int CopyTo(Span<T> output)

Copies the contents of this writer to the specified memory block.

ValueTask CopyToAsync<TConsumer>(TConsumer consumer, CancellationToken token) where TConsumer : ISupplier<ReadOnlyMemory<T>, CancellationToken, ValueTask>

Passes the contents of this writer to the callback asynchronously.

Attempts to get written content as contiguous block of memory.

void Write(ReadOnlySpan<T> input)

Writes the memory block.

void Write(T value)

Writes single element to this buffer.