Represents memory writer that is backed by the array obtained from the pool.
InheritancePoolingArrayBufferWriter<T>
Namespace: DotNext.Buffers Assembly: DotNext.dll Syntaxpublic sealed class PoolingArrayBufferWriter<T> : BufferWriter<T>, IBufferWriter<T>, ISupplier<ReadOnlyMemory<T>>, IFunctional<Func<ReadOnlyMemory<T>>>, IReadOnlyList<T>, IReadOnlyCollection<T>, IGrowableBuffer<T>, IReadOnlySpanConsumer<T>, ISupplier<ReadOnlyMemory<T>, CancellationToken, ValueTask>, IFunctional<Func<ReadOnlyMemory<T>, CancellationToken, ValueTask>>, IDisposable, IResettable, ISupplier<ArraySegment<T>>, IFunctional<Func<ArraySegment<T>>>, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
Type Parameters Name Description T
The data type that can be written.
Constructors | Edit this page View Source PoolingArrayBufferWriter(ArrayPool<T>?)Represents memory writer that is backed by the array obtained from the pool.
Declarationpublic PoolingArrayBufferWriter(ArrayPool<T>? pool = null)
Parameters Type Name Description ArrayPool<T> pool
The array pool.
Properties | Edit this page View Source CapacityGets or sets the total amount of space within the underlying memory.
Declarationpublic override int Capacity { get; init; }
Property Value Overrides Exceptions | Edit this page View Source this[int]
Gets the element at the specified index.
Declarationpublic ref T this[int index] { get; }
Parameters Type Name Description int index
The index of the element to retrieve.
Property Value Type Description TThe element at the specified index.
Exceptions | Edit this page View Source WrittenArrayGets the data written to the underlying array so far.
Declarationpublic ArraySegment<T> WrittenArray { get; }
Property Value Exceptions | Edit this page View Source WrittenMemory
Gets the data written to the underlying buffer so far.
Declarationpublic override ReadOnlyMemory<T> WrittenMemory { get; }
Property Value Overrides Exceptions Methods | Edit this page View Source AddAll(ICollection<T>)
Writes multiple elements.
Declarationpublic override void AddAll(ICollection<T> items)
Parameters Type Name Description ICollection<T> items
The collection of elements to be copied.
Overrides Exceptions | Edit this page View Source Clear(bool)Clears the data written to the underlying memory.
Declarationpublic override void Clear(bool reuseBuffer = false)
Parameters Type Name Description bool reuseBuffer
true to reuse the internal buffer; false to destroy the internal buffer.
Overrides Exceptions | Edit this page View Source DetachBuffer()Transfers ownership of the written memory from this writer to the caller.
Declarationpublic override MemoryOwner<T> DetachBuffer()
Returns Type Description MemoryOwner<T>
The object representing all written content.
Overrides Exceptions | Edit this page View Source Dispose(bool)Releases managed and unmanaged resources associated with this object.
Declarationprotected override void Dispose(bool disposing)
Parameters Overrides | Edit this page View Source GetArray(int)
Returns the memory to write to that is at least the requested size.
Declarationpublic ArraySegment<T> GetArray(int sizeHint = 0)
Parameters Type Name Description int sizeHint
The minimum length of the returned memory.
Returns Type Description ArraySegment<T>The memory block of at least the size sizeHint
.
Returns the memory to write to that is at least the requested size.
Declarationpublic override Memory<T> GetMemory(int sizeHint = 0)
Parameters Type Name Description int sizeHint
The minimum length of the returned memory.
Returns Type Description Memory<T>The memory block of at least the size sizeHint
.
Returns the memory to write to that is at least the requested size.
Declarationpublic override Span<T> GetSpan(int sizeHint = 0)
Parameters Type Name Description int sizeHint
The minimum length of the returned memory.
Returns Type Description Span<T>The memory block of at least the size sizeHint
.
Inserts the elements into this buffer at the specified index.
Declarationpublic void Insert(int index, ReadOnlySpan<T> items)
Parameters Type Name Description int index
The zero-based index at which the new elements should be inserted.
ReadOnlySpan<T> itemsThe span whose elements should be inserted into this buffer.
Exceptions | Edit this page View Source Overwrite(int, ReadOnlySpan<T>)Overwrites the elements in this buffer.
Declarationpublic void Overwrite(int index, ReadOnlySpan<T> items)
Parameters Type Name Description int index
The zero-based index at which the new elements should be rewritten.
ReadOnlySpan<T> itemsThe span whose elements should be added into this buffer.
Exceptions | Edit this page View Source RemoveFirst(int)Removes the specified number of elements from the head of this buffer.
Declarationpublic void RemoveFirst(int count)
Parameters Type Name Description int count
The number of elements to be removed from the head of this buffer.
Exceptions | Edit this page View Source RemoveLast(int)Removes the specified number of elements from the tail of this buffer.
Declarationpublic void RemoveLast(int count)
Parameters Type Name Description int count
The number of elements to be removed from the tail of this buffer.
Exceptions Implements Extension MethodsRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4