DotNext by Roman Sakno

<PackageReference Include="DotNext" Version="1.2.4" />

 ArrayRental<T>

public struct ArrayRental<T> : IDisposable
Represents array obtained from array pool.
public bool IsEmpty { get; }

Gets value indicating that this object is empty.

public ref T this[long index] { get; }

Gets the array element by its index.

public int Length { get; }

Gets length of the rented array.

public Memory<T> Memory { get; }

Gets the memory associated with the rented array.

public ArraySegment<T> Segment { get; }

Gets the rented array.

public Span<T> Span { get; }

Gets the span of array elements.

public ArrayRental(ArrayPool<T> pool, int minimumLength, bool clearArray = false)

Obtains a new array from array pool.

public ArrayRental(int minimumLength, bool clearArray = false)

Obtains a new array from Shared.

public ArrayRental(T[] array, int length)

Rents the array.

public ArrayRental(T[] array)

Rents the array.

public static T[] op_Explicit(ref ArrayRental rental)

Obtains rented array.

public void Dispose()

Returns the array back to the pool.

public ref T GetPinnableReference()

Obtains managed pointer to the first element of the rented array.

public ArraySegment<T> Slice(int offset, int count)

Returns a slice of the rented array.