MemoryBufferWriter<T> Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents an output sink into which T
data can be written, backed by a Memory<T> instance.
public sealed class MemoryBufferWriter<T> : CommunityToolkit.HighPerformance.Buffers.IBuffer<T>, System.Buffers.IBufferWriter<T>
type MemoryBufferWriter<'T> = class
interface IBuffer<'T>
interface IBufferWriter<'T>
Public NotInheritable Class MemoryBufferWriter(Of T)
Implements IBuffer(Of T), IBufferWriter(Of T)
Type Parameters
- T
The type of items to write to the current instance.
- Inheritance
-
MemoryBufferWriter<T>
- Implements
Remarks
This is a custom IBufferWriter<T> implementation that wraps a Memory<T> instance. It can be used to bridge APIs consuming an IBufferWriter<T> with existing Memory<T> instances (or objects that can be converted to a Memory<T>), to ensure the data is written directly to the intended buffer, with no possibility of doing additional allocations or expanding the available capacity.
Constructors
MemoryBufferWriter<T>(Memory<T>) |
Initializes a new instance of the MemoryBufferWriter<T> class. |
Properties
Capacity | |
FreeCapacity | |
WrittenCount | |
WrittenMemory | |
WrittenSpan |
Methods
Advance(Int32) | |
Clear() | |
GetMemory(Int32) | |
GetSpan(Int32) | |
ToString() |
Returns a string that represents the current object. |
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. |