Struct ArrayPoolToken<T>
Represents a disposable token that contains a buffer rented from an ArrayPool<T> instance.
public readonly struct ArrayPoolToken<T> : IDisposable
Type Parameters
T
The type of the objects that are in the resource pool.
- Implements
- Inherited Members
- Extension Methods
Properties
ClearArray
Indicates whether the contents of the buffer should be cleared before reuse, when this token gets disposed.
public bool ClearArray { get; }
Property Value
Length
Requested buffer length.
public int Length { get; }
Property Value
Pool
Source resource pool.
public ArrayPool<T>? Pool { get; }
Property Value
- ArrayPool<T>
Source
Rented buffer.
public T[] Source { get; }
Property Value
- T[]
Methods
AsMemory()
Creates a new Memory<T> instance from this token.
[Pure]
public Memory<T> AsMemory()
Returns
AsSpan()
Creates a new Span<T> instance from this token.
[Pure]
public Span<T> AsSpan()
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()