Class Payload
Namespace: DotBoxD.Services.Buffers
Assembly: DotBoxD.Services.dll
A single-owner buffer rented from System.Buffers.ArrayPool. Dispose returns the
backing array to the pool exactly once. Treat DotBoxD.Services.Buffers.Payload.Memory as read-only after
the buffer has been handed off (it is mutable only to support the receive fill path and
the System.Buffers.IMemoryOwner contract).
public sealed class Payload : IMemoryOwner<byte>, IDisposableInheritance
Section titled “Inheritance”Implements
Section titled “Implements”IMemoryOwner<byte>, IDisposable
Inherited Members
Section titled “Inherited Members”object.Equals(object), object.Equals(object, object), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object, object), object.ToString()
Properties
Section titled “Properties”Shared empty payload. Wraps System.Array.Empty; DotBoxD.Services.Buffers.Payload.Dispose is a
guaranteed no-op so the singleton stays reusable.
public static Payload Empty { get; }Property Value
Section titled “Property Value”Length
Section titled “ Length”The number of usable bytes in the payload.
public int Length { get; }Property Value
Section titled “Property Value”Memory
Section titled “ Memory”The usable region of the rented buffer. Mutable to support the receive fill path; treat as read-only once the payload has been received.
public Memory<byte> Memory { get; }Property Value
Section titled “Property Value”A read-only view of the usable region of the rented buffer.
public ReadOnlySpan<byte> Span { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Dispose()
Section titled “ Dispose()”Returns the backing array to the pool. Idempotent and safe to call on DotBoxD.Services.Buffers.Payload.Empty.
public void Dispose()Rent(int)
Section titled “ Rent(int)”Rents a payload of at least length bytes. A zero length returns the
shared DotBoxD.Services.Buffers.Payload.Empty singleton.
public static Payload Rent(int length)Parameters
Section titled “Parameters”length int