ArrayBufferWriter<T> 类

定义

表示基于堆、使用数组的输出接收器,可向其中Represents a heap-based, array-backed output sink into which 写入数据。data can be written.

generic <typename T>
public ref class ArrayBufferWriter sealed : System::Buffers::IBufferWriter<T>
public sealed class ArrayBufferWriter<T> : System.Buffers.IBufferWriter<T>
type ArrayBufferWriter<'T> = class
    interface IBufferWriter<'T>
Public NotInheritable Class ArrayBufferWriter(Of T)
Implements IBufferWriter(Of T)

类型参数

T

此实例中的项的类型 ArrayBufferWriter<T>The type of the items in this ArrayBufferWriter<T> instance.

继承
ArrayBufferWriter<T>
实现

构造函数

ArrayBufferWriter<T>()

创建具有默认初始容量的 ArrayBufferWriter<T> 实例,可向其中写入数据。Creates an instance of an ArrayBufferWriter<T> to which data can be written, with the default initial capacity.

ArrayBufferWriter<T>(Int32)

创建具有指定初始容量的 ArrayBufferWriter<T> 实例,可向其中写入数据。Creates an instance of an ArrayBufferWriter<T> to which data can be written, with a specified initial capacity.

属性

Capacity

获取基础缓冲区内的空间总量。Gets the total amount of space within the underlying buffer.

FreeCapacity

获取可用于写入而不会迫使基础缓冲区增长的空间量。Gets the amount of available space that can be written to without forcing the underlying buffer to grow.

WrittenCount

获取写入基础缓冲区的数据量。Gets the amount of data written to the underlying buffer.

WrittenMemory

获取 ReadOnlyMemory<T>,其中包含迄今为止写入基础缓冲区的数据。Gets a ReadOnlyMemory<T> that contains the data written to the underlying buffer so far.

WrittenSpan

获取 ReadOnlySpan<T>,其中包含迄今为止写入基础缓冲区的数据。Gets a ReadOnlySpan<T> that contains the data written to the underlying buffer so far.

方法

Advance(Int32)

通知 IBufferWriter<T>count 个项已写入 Span<T>/Memory<T>Notifies the IBufferWriter<T> that count items were written to the output Span<T>/Memory<T>

Clear()

清除写入基础缓冲区的数据。Clears the data written to the underlying buffer.

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetMemory(Int32)

返回要向其中写入数据的 Memory<T>,其长度至少是 sizeHint 指定的长度。Returns a Memory<T> to write to that is at least the length specified by sizeHint.

GetSpan(Int32)

返回要向其中写入数据的 Span<T>,其长度至少为指定长度。Returns a Span<T> to write to that is at least a specified length.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

扩展方法

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

value 的内容写入到 writerWrites the contents of value to writer.

适用于