Share via


PooledSpan<T> Struct

Definition

This allows for the request of a pooled array that can be used in a using scope to reduce allocations in hot paths.

[System.Runtime.CompilerServices.IsByRefLike]
public ref struct PooledSpan<T>
[<System.Runtime.CompilerServices.IsByRefLike>]
type PooledSpan<'T> = struct
Public Structure PooledSpan(Of T)

Type Parameters

T

The type of array to create.

Inheritance
PooledSpan<T>
Attributes

Constructors

PooledSpan<T>(IEnumerable<T>, Boolean, ArrayPool<T>)

Request a pooled array that copies elements from the provided IEnumerable<T>

PooledSpan<T>(Int32, Boolean, ArrayPool<T>)

Request a pooled array that is of the specified size.

Properties

Pool

The pool to request arrays from.

Span

A Span<T> representing a pooled instance.

Methods

Dispose()

Returns the array to the pool.

GetEnumerator()

The enumerator for the pooled instance.

Applies to