FixedSizeBuffers

Interface IFixedSizeBuffer<T>

An interface for operations on fixed size buffers.

NB: You probably don't want to mention this interface directly (don't box the buffer!). Use it as a type parameter constraint instead (where TBuffer : IFixedSizeBuffer<T>).

Declaration
public interface IFixedSizeBuffer<T> : IDisposable
Type Parameters
Name Description

T

The type of the elements in the buffer

Properties

Item[Int32]

Gets or sets the element at offset index.

Declaration
T this[int index] { get; set; }
Parameters
Type Name Description

Int32

index

The index

Property Value
Type Description

T

The element at offset index.

Exceptions
Type Condition

ArgumentOutOfRangeException

The index was outside the bounds of the buffer

Methods

AsReadOnlySpan()

Returns a ReadOnlySpan<T> representing the buffer.

This method is unsafe. You must ensure the ReadOnlySpan<T> does not outlive the buffer itself.

Declaration
ReadOnlySpan<T> AsReadOnlySpan()
Returns
Type Description

ReadOnlySpan<T>

A ReadOnlySpan<T> representing the buffer.

AsSpan()

Returns a Span<T> representing the buffer.

This method is unsafe. You must ensure the Span<T> does not outlive the buffer itself.

Declaration
Span<T> AsSpan()
Returns
Type Description

Span<T>

A Span<T> representing the buffer.