Edytuj

Udostępnij za pośrednictwem


ArrayPoolBufferWriter<T> Class

Definition

Represents a heap-based, array-backed output sink into which T data can be written.

public sealed class ArrayPoolBufferWriter<T> : IDisposable, Microsoft.Toolkit.HighPerformance.Buffers.IBuffer<T>, System.Buffers.IBufferWriter<T>, System.Buffers.IMemoryOwner<T>
public sealed class ArrayPoolBufferWriter<T> : Microsoft.Toolkit.HighPerformance.Buffers.IBuffer<T>, System.Buffers.IBufferWriter<T>, System.Buffers.IMemoryOwner<T>
type ArrayPoolBufferWriter<'T> = class
    interface IBuffer<'T>
    interface IBufferWriter<'T>
    interface IMemoryOwner<'T>
    interface IDisposable
Public NotInheritable Class ArrayPoolBufferWriter(Of T)
Implements IBuffer(Of T), IBufferWriter(Of T), IDisposable, IMemoryOwner(Of T)
Public NotInheritable Class ArrayPoolBufferWriter(Of T)
Implements IBuffer(Of T), IBufferWriter(Of T), IMemoryOwner(Of T)

Type Parameters

T

The type of items to write to the current instance.

Inheritance
ArrayPoolBufferWriter<T>
Implements

Remarks

This is a custom IBufferWriter<T> implementation that replicates the functionality and API surface of the array-based buffer writer available in .NET Standard 2.1, with the main difference being the fact that in this case the arrays in use are rented from the shared ArrayPool<T> instance, and that ArrayPoolBufferWriter<T> is also available on .NET Standard 2.0.

Constructors

ArrayPoolBufferWriter<T>()

Initializes a new instance of the ArrayPoolBufferWriter<T> class.

ArrayPoolBufferWriter<T>(ArrayPool<T>, Int32)

Initializes a new instance of the ArrayPoolBufferWriter<T> class.

ArrayPoolBufferWriter<T>(ArrayPool<T>)

Initializes a new instance of the ArrayPoolBufferWriter<T> class.

ArrayPoolBufferWriter<T>(Int32)

Initializes a new instance of the ArrayPoolBufferWriter<T> class.

Properties

Capacity
FreeCapacity
WrittenCount
WrittenMemory
WrittenSpan

Methods

Advance(Int32)
Clear()
Dispose()

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

Finalize()

Finalizes an instance of the ArrayPoolBufferWriter<T> class.

GetMemory(Int32)
GetSpan(Int32)
ToString()

Returns a string that represents the current object.

Explicit Interface Implementations

IMemoryOwner<T>.Memory

Extension Methods

Write<T>(IBufferWriter<T>, T)

Writes a value of a specified type into a target IBufferWriter<T> instance.

Write<T>(IBufferWriter<T>, ReadOnlySpan<T>)
Write<T>(IBufferWriter<T>, T)

Writes a value of a specified type into a target IBufferWriter<T> instance.

Write<T>(IBufferWriter<T>, ReadOnlySpan<T>)
Write<T>(IBufferWriter<T>, T)

Writes a value of a specified type into a target IBufferWriter<T> instance.

Applies to